happy-imou-cloud 2.1.14 → 2.1.16

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 (27) hide show
  1. package/dist/{BaseReasoningProcessor-BopJzCX1.cjs → BaseReasoningProcessor-D6AIOycG.cjs} +2 -2
  2. package/dist/{BaseReasoningProcessor-DBI-wmAq.mjs → BaseReasoningProcessor-TghqGOqo.mjs} +2 -2
  3. package/dist/{ProviderSelectionHandler-BBhFPe8E.mjs → ProviderSelectionHandler-Be6q2nTi.mjs} +2 -2
  4. package/dist/{ProviderSelectionHandler-D-g808TK.cjs → ProviderSelectionHandler-DxDz5NAw.cjs} +2 -2
  5. package/dist/{api-CleaBHoF.cjs → api-BUAppqAe.cjs} +72 -8
  6. package/dist/{api-ehyDSOc5.mjs → api-BePMt8XI.mjs} +72 -9
  7. package/dist/{command-jYweihkY.cjs → command-CAZ2gxud.cjs} +3 -3
  8. package/dist/{command-o-MfrQiP.mjs → command-DlRscTrt.mjs} +3 -3
  9. package/dist/{index-aAcmZ774.cjs → index-LKiNbRQ1.cjs} +48 -13
  10. package/dist/{index-DN6ihUoI.mjs → index-OfWx3GbO.mjs} +45 -10
  11. package/dist/index.cjs +3 -3
  12. package/dist/index.mjs +3 -3
  13. package/dist/lib.cjs +1 -1
  14. package/dist/lib.d.cts +54 -0
  15. package/dist/lib.d.mts +54 -0
  16. package/dist/lib.mjs +1 -1
  17. package/dist/{persistence-DBVrW1P5.mjs → persistence-BOtU4fYZ.mjs} +1 -1
  18. package/dist/{persistence-oHFJbsvr.cjs → persistence-CQ1ub64T.cjs} +1 -1
  19. package/dist/{registerKillSessionHandler-3R7E1V6V.cjs → registerKillSessionHandler-BTabJYFZ.cjs} +347 -5
  20. package/dist/{registerKillSessionHandler-BVnsXvxn.mjs → registerKillSessionHandler-DcFWS8JV.mjs} +347 -5
  21. package/dist/{runClaude-0rReIj8o.mjs → runClaude-BhJT-JJJ.mjs} +13 -7
  22. package/dist/{runClaude-C1eZZv8o.cjs → runClaude-COLx_2h1.cjs} +13 -7
  23. package/dist/{runCodex-CwT9QIML.mjs → runCodex-BNznOpcn.mjs} +16 -27
  24. package/dist/{runCodex-BROvg6-O.cjs → runCodex-CcOicO3f.cjs} +16 -27
  25. package/dist/{runGemini-BlJNEB-g.mjs → runGemini-C-ADeQ79.mjs} +13 -7
  26. package/dist/{runGemini-C-oJCLfz.cjs → runGemini-iSsDFz8x.cjs} +13 -7
  27. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-aAcmZ774.cjs');
4
- var api = require('./api-CleaBHoF.cjs');
3
+ var index = require('./index-LKiNbRQ1.cjs');
4
+ var api = require('./api-BUAppqAe.cjs');
5
5
  var node_events = require('node:events');
6
6
  var node_crypto = require('node:crypto');
7
7
 
@@ -1,5 +1,5 @@
1
- import { a as createSessionMetadata, p as publishSessionRegistration } from './index-DN6ihUoI.mjs';
2
- import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-ehyDSOc5.mjs';
1
+ import { a as createSessionMetadata, p as publishSessionRegistration } from './index-OfWx3GbO.mjs';
2
+ import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-BePMt8XI.mjs';
3
3
  import { EventEmitter } from 'node:events';
4
4
  import { randomUUID } from 'node:crypto';
5
5
 
@@ -1,5 +1,5 @@
1
- import { l as logger } from './api-ehyDSOc5.mjs';
2
- import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-BVnsXvxn.mjs';
1
+ import { l as logger } from './api-BePMt8XI.mjs';
2
+ import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-DcFWS8JV.mjs';
3
3
 
4
4
  async function runModeLoop(opts) {
5
5
  let currentMode = opts.startingMode;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var api = require('./api-CleaBHoF.cjs');
4
- var registerKillSessionHandler = require('./registerKillSessionHandler-3R7E1V6V.cjs');
3
+ var api = require('./api-BUAppqAe.cjs');
4
+ var registerKillSessionHandler = require('./registerKillSessionHandler-BTabJYFZ.cjs');
5
5
 
6
6
  async function runModeLoop(opts) {
7
7
  let currentMode = opts.startingMode;
@@ -18,7 +18,7 @@ var node_child_process = require('node:child_process');
18
18
  var expoServerSdk = require('expo-server-sdk');
19
19
 
20
20
  var name = "happy-imou-cloud";
21
- var version = "2.1.14";
21
+ var version = "2.1.16";
22
22
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
23
23
  var author = "long.zhu";
24
24
  var license = "MIT";
@@ -433,7 +433,7 @@ async function listDaemonLogFiles(limit = 50) {
433
433
  return { file, path: fullPath, modified: stats.mtime };
434
434
  }).sort((a, b) => b.modified.getTime() - a.modified.getTime());
435
435
  try {
436
- const { readDaemonState } = await Promise.resolve().then(function () { return require('./persistence-oHFJbsvr.cjs'); });
436
+ const { readDaemonState } = await Promise.resolve().then(function () { return require('./persistence-CQ1ub64T.cjs'); });
437
437
  const state = await readDaemonState();
438
438
  if (!state) {
439
439
  return logs;
@@ -599,6 +599,20 @@ const HappyOrgReplyContextSchema = z.z.object({
599
599
  scope: z.z.string().min(1),
600
600
  replyTo: z.z.string().min(1)
601
601
  });
602
+ const HappyOrgDispatchBusinessAckStatusSchema = z.z.enum([
603
+ "accepted",
604
+ "standby",
605
+ "blocked"
606
+ ]);
607
+ const HappyOrgDispatchAckLedgerEntrySchema = z.z.object({
608
+ dispatchId: z.z.string().min(1),
609
+ scope: z.z.string().min(1),
610
+ taskAck: z.z.string().min(1),
611
+ readAck: z.z.literal("yes"),
612
+ status: HappyOrgDispatchBusinessAckStatusSchema,
613
+ note: z.z.string().nullable(),
614
+ acknowledgedAt: z.z.number().int().nonnegative()
615
+ });
602
616
  const HappyOrgSpecialistHomeIdentitySchema = z.z.object({
603
617
  homeSlug: z.z.string().min(1),
604
618
  path: z.z.string().min(1).nullish(),
@@ -657,6 +671,7 @@ z.z.object({
657
671
  runtime: HappyOrgRuntimeStateSchema.optional(),
658
672
  activeOwner: HappyOrgTaskOwnershipSchema.nullish(),
659
673
  replyContext: HappyOrgReplyContextSchema.nullish(),
674
+ dispatchAcks: z.z.record(z.z.string(), HappyOrgDispatchAckLedgerEntrySchema).optional(),
660
675
  specialistHome: HappyOrgSpecialistHomeIdentitySchema.nullish(),
661
676
  repeat: z.z.object({
662
677
  threshold: z.z.number().int().positive(),
@@ -948,6 +963,22 @@ function buildSessionRuntimeIndex(metadata) {
948
963
  };
949
964
  }
950
965
 
966
+ function preserveSessionRuntimeMetadata(current, next) {
967
+ if (!current) {
968
+ return next;
969
+ }
970
+ return {
971
+ ...next,
972
+ ...next.machineId ? {} : current.machineId ? { machineId: current.machineId } : {},
973
+ ...typeof next.hostPid === "number" ? {} : typeof current.hostPid === "number" ? { hostPid: current.hostPid } : {},
974
+ ...typeof next.startedFromDaemon === "boolean" ? {} : typeof current.startedFromDaemon === "boolean" ? { startedFromDaemon: current.startedFromDaemon } : {},
975
+ ...next.startedBy ? {} : current.startedBy ? { startedBy: current.startedBy } : {},
976
+ ...next.lifecycleState ? {} : current.lifecycleState ? { lifecycleState: current.lifecycleState } : {},
977
+ ...typeof next.lifecycleStateSince === "number" ? {} : typeof current.lifecycleStateSince === "number" ? { lifecycleStateSince: current.lifecycleStateSince } : {},
978
+ ...next.flavor ? {} : current.flavor ? { flavor: current.flavor } : {}
979
+ };
980
+ }
981
+
951
982
  async function delay(ms) {
952
983
  return new Promise((resolve) => setTimeout(resolve, ms));
953
984
  }
@@ -1933,6 +1964,12 @@ class ApiSessionClient extends node_events.EventEmitter {
1933
1964
  getAgentStateSnapshot() {
1934
1965
  return this.agentState;
1935
1966
  }
1967
+ mergeRuntimeMetadata(next) {
1968
+ if (!next) {
1969
+ return next;
1970
+ }
1971
+ return preserveSessionRuntimeMetadata(this.metadata, next);
1972
+ }
1936
1973
  async waitForMetadataUpdate(signal) {
1937
1974
  if (signal?.aborted) {
1938
1975
  throw createAbortError();
@@ -2176,7 +2213,7 @@ class ApiSessionClient extends node_events.EventEmitter {
2176
2213
  updateMetadata(handler) {
2177
2214
  void this.metadataLock.inLock(async () => {
2178
2215
  await backoff(async () => {
2179
- let updated = handler(this.metadata);
2216
+ let updated = this.mergeRuntimeMetadata(handler(this.metadata));
2180
2217
  const sessionIndex = buildSessionRuntimeIndex(updated);
2181
2218
  const answer = await this.socket.emitWithAck("update-metadata", {
2182
2219
  sid: this.sessionId,
@@ -2185,13 +2222,17 @@ class ApiSessionClient extends node_events.EventEmitter {
2185
2222
  ...sessionIndex ? { sessionIndex } : {}
2186
2223
  });
2187
2224
  if (answer.result === "success") {
2188
- this.metadata = decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(answer.metadata));
2225
+ this.metadata = this.mergeRuntimeMetadata(
2226
+ decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(answer.metadata))
2227
+ );
2189
2228
  this.metadataVersion = answer.version;
2190
2229
  this.emit("metadata-updated", this.metadata);
2191
2230
  } else if (answer.result === "version-mismatch") {
2192
2231
  if (answer.version > this.metadataVersion) {
2193
2232
  this.metadataVersion = answer.version;
2194
- this.metadata = decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(answer.metadata));
2233
+ this.metadata = this.mergeRuntimeMetadata(
2234
+ decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(answer.metadata))
2235
+ );
2195
2236
  this.emit("metadata-updated", this.metadata);
2196
2237
  }
2197
2238
  throw new Error("Metadata version mismatch");
@@ -2278,7 +2319,9 @@ class ApiSessionClient extends node_events.EventEmitter {
2278
2319
  return;
2279
2320
  }
2280
2321
  if (sessionBody.metadata && sessionBody.metadata.version > this.metadataVersion) {
2281
- this.metadata = decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(sessionBody.metadata.value));
2322
+ this.metadata = this.mergeRuntimeMetadata(
2323
+ decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(sessionBody.metadata.value))
2324
+ );
2282
2325
  this.metadataVersion = sessionBody.metadata.version;
2283
2326
  this.emit("metadata-updated", this.metadata);
2284
2327
  }
@@ -2440,7 +2483,9 @@ class ApiSessionClient extends node_events.EventEmitter {
2440
2483
  }
2441
2484
  applyProtocolV3SessionOverlay(session) {
2442
2485
  if (typeof session.metadataVersion === "number" && typeof session.metadata === "string" && session.metadataVersion > this.metadataVersion) {
2443
- this.metadata = decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(session.metadata));
2486
+ this.metadata = this.mergeRuntimeMetadata(
2487
+ decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(session.metadata))
2488
+ );
2444
2489
  this.metadataVersion = session.metadataVersion;
2445
2490
  this.emit("metadata-updated", this.metadata);
2446
2491
  }
@@ -2473,11 +2518,12 @@ class ApiSessionClient extends node_events.EventEmitter {
2473
2518
  if (version <= this.metadataVersion) {
2474
2519
  break;
2475
2520
  }
2476
- this.metadata = decrypt(
2521
+ const nextMetadata = decrypt(
2477
2522
  this.encryptionKey,
2478
2523
  this.encryptionVariant,
2479
2524
  decodeBase64(metadataUpdate.value)
2480
2525
  );
2526
+ this.metadata = this.mergeRuntimeMetadata(nextMetadata);
2481
2527
  this.metadataVersion = version;
2482
2528
  this.emit("metadata-updated", this.metadata);
2483
2529
  }
@@ -3648,6 +3694,23 @@ class ApiClient {
3648
3694
  });
3649
3695
  return response.data.receipt;
3650
3696
  }
3697
+ async submitOrganizationDispatchBusinessAck(opts) {
3698
+ const response = await this.request({
3699
+ method: "POST",
3700
+ url: `${configuration.serverUrl}/control/v1/dispatches/${encodeURIComponent(opts.dispatchId)}/ack`,
3701
+ data: {
3702
+ memberAgentId: opts.memberAgentId,
3703
+ scope: opts.scope,
3704
+ read_ack: opts.readAck,
3705
+ task_ack: opts.taskAck,
3706
+ status: opts.status,
3707
+ note: opts.note ?? null
3708
+ },
3709
+ headers: { "x-happy-organization-id": opts.organizationId },
3710
+ timeout: 1e4
3711
+ });
3712
+ return response.data.receipt;
3713
+ }
3651
3714
  async getProtocolV3Descriptor() {
3652
3715
  const url = `${configuration.serverUrl}/v3/capabilities`;
3653
3716
  const payload = await this.requestProtocolV3Resource({
@@ -4059,4 +4122,5 @@ exports.getLatestDaemonLog = getLatestDaemonLog;
4059
4122
  exports.isAuthenticationRequiredError = isAuthenticationRequiredError;
4060
4123
  exports.logger = logger;
4061
4124
  exports.packageJson = packageJson;
4125
+ exports.preserveSessionRuntimeMetadata = preserveSessionRuntimeMetadata;
4062
4126
  exports.startOfflineReconnection = startOfflineReconnection;
@@ -16,7 +16,7 @@ import { spawn } from 'node:child_process';
16
16
  import { Expo } from 'expo-server-sdk';
17
17
 
18
18
  var name = "happy-imou-cloud";
19
- var version = "2.1.14";
19
+ var version = "2.1.16";
20
20
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
21
21
  var author = "long.zhu";
22
22
  var license = "MIT";
@@ -431,7 +431,7 @@ async function listDaemonLogFiles(limit = 50) {
431
431
  return { file, path: fullPath, modified: stats.mtime };
432
432
  }).sort((a, b) => b.modified.getTime() - a.modified.getTime());
433
433
  try {
434
- const { readDaemonState } = await import('./persistence-DBVrW1P5.mjs');
434
+ const { readDaemonState } = await import('./persistence-BOtU4fYZ.mjs');
435
435
  const state = await readDaemonState();
436
436
  if (!state) {
437
437
  return logs;
@@ -597,6 +597,20 @@ const HappyOrgReplyContextSchema = z.object({
597
597
  scope: z.string().min(1),
598
598
  replyTo: z.string().min(1)
599
599
  });
600
+ const HappyOrgDispatchBusinessAckStatusSchema = z.enum([
601
+ "accepted",
602
+ "standby",
603
+ "blocked"
604
+ ]);
605
+ const HappyOrgDispatchAckLedgerEntrySchema = z.object({
606
+ dispatchId: z.string().min(1),
607
+ scope: z.string().min(1),
608
+ taskAck: z.string().min(1),
609
+ readAck: z.literal("yes"),
610
+ status: HappyOrgDispatchBusinessAckStatusSchema,
611
+ note: z.string().nullable(),
612
+ acknowledgedAt: z.number().int().nonnegative()
613
+ });
600
614
  const HappyOrgSpecialistHomeIdentitySchema = z.object({
601
615
  homeSlug: z.string().min(1),
602
616
  path: z.string().min(1).nullish(),
@@ -655,6 +669,7 @@ z.object({
655
669
  runtime: HappyOrgRuntimeStateSchema.optional(),
656
670
  activeOwner: HappyOrgTaskOwnershipSchema.nullish(),
657
671
  replyContext: HappyOrgReplyContextSchema.nullish(),
672
+ dispatchAcks: z.record(z.string(), HappyOrgDispatchAckLedgerEntrySchema).optional(),
658
673
  specialistHome: HappyOrgSpecialistHomeIdentitySchema.nullish(),
659
674
  repeat: z.object({
660
675
  threshold: z.number().int().positive(),
@@ -946,6 +961,22 @@ function buildSessionRuntimeIndex(metadata) {
946
961
  };
947
962
  }
948
963
 
964
+ function preserveSessionRuntimeMetadata(current, next) {
965
+ if (!current) {
966
+ return next;
967
+ }
968
+ return {
969
+ ...next,
970
+ ...next.machineId ? {} : current.machineId ? { machineId: current.machineId } : {},
971
+ ...typeof next.hostPid === "number" ? {} : typeof current.hostPid === "number" ? { hostPid: current.hostPid } : {},
972
+ ...typeof next.startedFromDaemon === "boolean" ? {} : typeof current.startedFromDaemon === "boolean" ? { startedFromDaemon: current.startedFromDaemon } : {},
973
+ ...next.startedBy ? {} : current.startedBy ? { startedBy: current.startedBy } : {},
974
+ ...next.lifecycleState ? {} : current.lifecycleState ? { lifecycleState: current.lifecycleState } : {},
975
+ ...typeof next.lifecycleStateSince === "number" ? {} : typeof current.lifecycleStateSince === "number" ? { lifecycleStateSince: current.lifecycleStateSince } : {},
976
+ ...next.flavor ? {} : current.flavor ? { flavor: current.flavor } : {}
977
+ };
978
+ }
979
+
949
980
  async function delay(ms) {
950
981
  return new Promise((resolve) => setTimeout(resolve, ms));
951
982
  }
@@ -1931,6 +1962,12 @@ class ApiSessionClient extends EventEmitter {
1931
1962
  getAgentStateSnapshot() {
1932
1963
  return this.agentState;
1933
1964
  }
1965
+ mergeRuntimeMetadata(next) {
1966
+ if (!next) {
1967
+ return next;
1968
+ }
1969
+ return preserveSessionRuntimeMetadata(this.metadata, next);
1970
+ }
1934
1971
  async waitForMetadataUpdate(signal) {
1935
1972
  if (signal?.aborted) {
1936
1973
  throw createAbortError();
@@ -2174,7 +2211,7 @@ class ApiSessionClient extends EventEmitter {
2174
2211
  updateMetadata(handler) {
2175
2212
  void this.metadataLock.inLock(async () => {
2176
2213
  await backoff(async () => {
2177
- let updated = handler(this.metadata);
2214
+ let updated = this.mergeRuntimeMetadata(handler(this.metadata));
2178
2215
  const sessionIndex = buildSessionRuntimeIndex(updated);
2179
2216
  const answer = await this.socket.emitWithAck("update-metadata", {
2180
2217
  sid: this.sessionId,
@@ -2183,13 +2220,17 @@ class ApiSessionClient extends EventEmitter {
2183
2220
  ...sessionIndex ? { sessionIndex } : {}
2184
2221
  });
2185
2222
  if (answer.result === "success") {
2186
- this.metadata = decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(answer.metadata));
2223
+ this.metadata = this.mergeRuntimeMetadata(
2224
+ decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(answer.metadata))
2225
+ );
2187
2226
  this.metadataVersion = answer.version;
2188
2227
  this.emit("metadata-updated", this.metadata);
2189
2228
  } else if (answer.result === "version-mismatch") {
2190
2229
  if (answer.version > this.metadataVersion) {
2191
2230
  this.metadataVersion = answer.version;
2192
- this.metadata = decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(answer.metadata));
2231
+ this.metadata = this.mergeRuntimeMetadata(
2232
+ decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(answer.metadata))
2233
+ );
2193
2234
  this.emit("metadata-updated", this.metadata);
2194
2235
  }
2195
2236
  throw new Error("Metadata version mismatch");
@@ -2276,7 +2317,9 @@ class ApiSessionClient extends EventEmitter {
2276
2317
  return;
2277
2318
  }
2278
2319
  if (sessionBody.metadata && sessionBody.metadata.version > this.metadataVersion) {
2279
- this.metadata = decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(sessionBody.metadata.value));
2320
+ this.metadata = this.mergeRuntimeMetadata(
2321
+ decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(sessionBody.metadata.value))
2322
+ );
2280
2323
  this.metadataVersion = sessionBody.metadata.version;
2281
2324
  this.emit("metadata-updated", this.metadata);
2282
2325
  }
@@ -2438,7 +2481,9 @@ class ApiSessionClient extends EventEmitter {
2438
2481
  }
2439
2482
  applyProtocolV3SessionOverlay(session) {
2440
2483
  if (typeof session.metadataVersion === "number" && typeof session.metadata === "string" && session.metadataVersion > this.metadataVersion) {
2441
- this.metadata = decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(session.metadata));
2484
+ this.metadata = this.mergeRuntimeMetadata(
2485
+ decrypt(this.encryptionKey, this.encryptionVariant, decodeBase64(session.metadata))
2486
+ );
2442
2487
  this.metadataVersion = session.metadataVersion;
2443
2488
  this.emit("metadata-updated", this.metadata);
2444
2489
  }
@@ -2471,11 +2516,12 @@ class ApiSessionClient extends EventEmitter {
2471
2516
  if (version <= this.metadataVersion) {
2472
2517
  break;
2473
2518
  }
2474
- this.metadata = decrypt(
2519
+ const nextMetadata = decrypt(
2475
2520
  this.encryptionKey,
2476
2521
  this.encryptionVariant,
2477
2522
  decodeBase64(metadataUpdate.value)
2478
2523
  );
2524
+ this.metadata = this.mergeRuntimeMetadata(nextMetadata);
2479
2525
  this.metadataVersion = version;
2480
2526
  this.emit("metadata-updated", this.metadata);
2481
2527
  }
@@ -3646,6 +3692,23 @@ class ApiClient {
3646
3692
  });
3647
3693
  return response.data.receipt;
3648
3694
  }
3695
+ async submitOrganizationDispatchBusinessAck(opts) {
3696
+ const response = await this.request({
3697
+ method: "POST",
3698
+ url: `${configuration.serverUrl}/control/v1/dispatches/${encodeURIComponent(opts.dispatchId)}/ack`,
3699
+ data: {
3700
+ memberAgentId: opts.memberAgentId,
3701
+ scope: opts.scope,
3702
+ read_ack: opts.readAck,
3703
+ task_ack: opts.taskAck,
3704
+ status: opts.status,
3705
+ note: opts.note ?? null
3706
+ },
3707
+ headers: { "x-happy-organization-id": opts.organizationId },
3708
+ timeout: 1e4
3709
+ });
3710
+ return response.data.receipt;
3711
+ }
3649
3712
  async getProtocolV3Descriptor() {
3650
3713
  const url = `${configuration.serverUrl}/v3/capabilities`;
3651
3714
  const payload = await this.requestProtocolV3Resource({
@@ -4033,4 +4096,4 @@ var api = /*#__PURE__*/Object.freeze({
4033
4096
  ApiClient: ApiClient
4034
4097
  });
4035
4098
 
4036
- export { ApiClient as A, HAPPY_ORG_TURN_REPORT_TAG as H, SigningBootstrapRequiredError as S, ApiSessionClient as a, connectionState as b, configuration as c, HAPPY_ORG_SUMMARY_MAX_LENGTH as d, encodeBase64 as e, HAPPY_ORG_REPEAT_THRESHOLD as f, backoff as g, delay as h, isAuthenticationRequiredError as i, AsyncLock as j, buildAuthenticatedHeaders as k, logger as l, SIGNING_BOOTSTRAP_REQUIRED_MESSAGE as m, encodeBase64Url as n, buildClientHeaders as o, decodeBase64 as p, HAPPY_CLOUD_DAEMON_PORT as q, packageJson as r, startOfflineReconnection as s, HeadTailPreviewBuffer as t, getLatestDaemonLog as u, api as v };
4099
+ export { ApiClient as A, HAPPY_ORG_TURN_REPORT_TAG as H, SigningBootstrapRequiredError as S, ApiSessionClient as a, connectionState as b, configuration as c, HAPPY_ORG_SUMMARY_MAX_LENGTH as d, encodeBase64 as e, HAPPY_ORG_REPEAT_THRESHOLD as f, backoff as g, delay as h, isAuthenticationRequiredError as i, AsyncLock as j, buildAuthenticatedHeaders as k, logger as l, SIGNING_BOOTSTRAP_REQUIRED_MESSAGE as m, encodeBase64Url as n, buildClientHeaders as o, preserveSessionRuntimeMetadata as p, decodeBase64 as q, HAPPY_CLOUD_DAEMON_PORT as r, startOfflineReconnection as s, packageJson as t, HeadTailPreviewBuffer as u, getLatestDaemonLog as v, api as w };
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-aAcmZ774.cjs');
3
+ var index = require('./index-LKiNbRQ1.cjs');
4
4
  require('chalk');
5
- require('./api-CleaBHoF.cjs');
5
+ require('./api-BUAppqAe.cjs');
6
6
  require('axios');
7
7
  require('fs');
8
8
  require('node:fs');
@@ -18,7 +18,7 @@ require('crypto');
18
18
  require('path');
19
19
  require('node:child_process');
20
20
  require('expo-server-sdk');
21
- require('./persistence-oHFJbsvr.cjs');
21
+ require('./persistence-CQ1ub64T.cjs');
22
22
  require('node:fs/promises');
23
23
  require('os');
24
24
  require('tmp');
@@ -1,6 +1,6 @@
1
- import { c as createDefaultRuntimeShell } from './index-DN6ihUoI.mjs';
1
+ import { c as createDefaultRuntimeShell } from './index-OfWx3GbO.mjs';
2
2
  import 'chalk';
3
- import './api-ehyDSOc5.mjs';
3
+ import './api-BePMt8XI.mjs';
4
4
  import 'axios';
5
5
  import 'fs';
6
6
  import 'node:fs';
@@ -16,7 +16,7 @@ import 'crypto';
16
16
  import 'path';
17
17
  import 'node:child_process';
18
18
  import 'expo-server-sdk';
19
- import './persistence-DBVrW1P5.mjs';
19
+ import './persistence-BOtU4fYZ.mjs';
20
20
  import 'node:fs/promises';
21
21
  import 'os';
22
22
  import 'tmp';
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var chalk = require('chalk');
4
- var api = require('./api-CleaBHoF.cjs');
5
- var persistence = require('./persistence-oHFJbsvr.cjs');
4
+ var api = require('./api-BUAppqAe.cjs');
5
+ var persistence = require('./persistence-CQ1ub64T.cjs');
6
6
  var z = require('zod');
7
7
  var fs$2 = require('fs/promises');
8
8
  var os$1 = require('os');
@@ -72,7 +72,7 @@ async function openBrowser(url) {
72
72
  }
73
73
  }
74
74
 
75
- const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-aAcmZ774.cjs', document.baseURI).href)));
75
+ const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-LKiNbRQ1.cjs', document.baseURI).href)));
76
76
  const QRCode = require$1("qrcode-terminal/vendor/QRCode");
77
77
  const QRErrorCorrectLevel = require$1("qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel");
78
78
  const pendingTempFiles = /* @__PURE__ */ new Set();
@@ -695,7 +695,7 @@ function setupCleanupHandlers() {
695
695
  });
696
696
  }
697
697
 
698
- const __dirname$2 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-aAcmZ774.cjs', document.baseURI).href))));
698
+ const __dirname$2 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-LKiNbRQ1.cjs', document.baseURI).href))));
699
699
  function projectPath() {
700
700
  const path = path$1.resolve(__dirname$2, "..");
701
701
  return path;
@@ -6625,6 +6625,18 @@ function buildAcpSpawnSpec(params) {
6625
6625
  };
6626
6626
  }
6627
6627
 
6628
+ const MAX_DROPPED_LINE_PREVIEW_CHARS = 4096;
6629
+ function formatDroppedLinePreview(line) {
6630
+ if (line.length <= MAX_DROPPED_LINE_PREVIEW_CHARS) {
6631
+ return line;
6632
+ }
6633
+ const headChars = 2048;
6634
+ const tailChars = 1024;
6635
+ const omittedChars = Math.max(0, line.length - headChars - tailChars);
6636
+ return `${line.slice(0, headChars)}
6637
+ ...[stdout line truncated ${omittedChars} chars]...
6638
+ ${line.slice(-tailChars)}`;
6639
+ }
6628
6640
  function createAcpFilteredStdoutReadable(params) {
6629
6641
  const maxMultilineBytes = typeof params.maxMultilineBytes === "number" && Number.isFinite(params.maxMultilineBytes) && params.maxMultilineBytes > 0 ? Math.trunc(params.maxMultilineBytes) : 1e6;
6630
6642
  const decoder = new TextDecoder();
@@ -6634,9 +6646,10 @@ function createAcpFilteredStdoutReadable(params) {
6634
6646
  const reader = params.readable.getReader();
6635
6647
  let buffer = "";
6636
6648
  let multiline = null;
6649
+ let discardingOversizedLine = false;
6637
6650
  let controllerErrored = false;
6638
6651
  const drop = (reason, line) => {
6639
- params.onDroppedLine?.({ reason, line });
6652
+ params.onDroppedLine?.({ reason, line: formatDroppedLinePreview(line) });
6640
6653
  };
6641
6654
  const enqueueLine = (line) => {
6642
6655
  if (!line.trim()) {
@@ -6681,7 +6694,16 @@ function createAcpFilteredStdoutReadable(params) {
6681
6694
  if (!value) {
6682
6695
  continue;
6683
6696
  }
6684
- buffer += decoder.decode(value, { stream: true });
6697
+ let decodedChunk = decoder.decode(value, { stream: true });
6698
+ if (discardingOversizedLine) {
6699
+ const newlineIndex = decodedChunk.indexOf("\n");
6700
+ if (newlineIndex === -1) {
6701
+ continue;
6702
+ }
6703
+ decodedChunk = decodedChunk.slice(newlineIndex + 1);
6704
+ discardingOversizedLine = false;
6705
+ }
6706
+ buffer += decodedChunk;
6685
6707
  const lines = buffer.split("\n");
6686
6708
  buffer = lines.pop() || "";
6687
6709
  for (const line of lines) {
@@ -6692,6 +6714,10 @@ ${line}` : line;
6692
6714
  if (nextBytes > maxMultilineBytes) {
6693
6715
  drop("multiline_overflow", multiline.buf);
6694
6716
  multiline = null;
6717
+ if (line.length > maxMultilineBytes) {
6718
+ drop("multiline_overflow", line);
6719
+ continue;
6720
+ }
6695
6721
  enqueueLine(line);
6696
6722
  continue;
6697
6723
  }
@@ -6701,6 +6727,10 @@ ${line}` : line;
6701
6727
  }
6702
6728
  continue;
6703
6729
  }
6730
+ if (line.length > maxMultilineBytes) {
6731
+ drop("multiline_overflow", line);
6732
+ continue;
6733
+ }
6704
6734
  const trimmed = line.trim();
6705
6735
  if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
6706
6736
  try {
@@ -6716,6 +6746,11 @@ ${line}` : line;
6716
6746
  }
6717
6747
  enqueueLine(line);
6718
6748
  }
6749
+ if (buffer.length > maxMultilineBytes) {
6750
+ drop("multiline_overflow", buffer);
6751
+ buffer = "";
6752
+ discardingOversizedLine = true;
6753
+ }
6719
6754
  }
6720
6755
  if (multiline) {
6721
6756
  if (!tryFlushMultiline(multiline.buf)) {
@@ -9020,7 +9055,7 @@ class AbortError extends Error {
9020
9055
  }
9021
9056
  }
9022
9057
 
9023
- const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-aAcmZ774.cjs', document.baseURI).href)));
9058
+ const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-LKiNbRQ1.cjs', document.baseURI).href)));
9024
9059
  const __dirname$1 = path.join(__filename$1, "..");
9025
9060
  function getGlobalClaudeVersion() {
9026
9061
  try {
@@ -10319,11 +10354,11 @@ var launch = /*#__PURE__*/Object.freeze({
10319
10354
 
10320
10355
  const unifiedProviderExecutors = {
10321
10356
  claude: async (opts) => {
10322
- const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-C1eZZv8o.cjs'); });
10357
+ const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-COLx_2h1.cjs'); });
10323
10358
  await runClaude(opts.credentials, opts.claudeOptions ?? {});
10324
10359
  },
10325
10360
  codex: async (opts) => {
10326
- const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-BROvg6-O.cjs'); });
10361
+ const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-CcOicO3f.cjs'); });
10327
10362
  await runCodex({
10328
10363
  credentials: opts.credentials,
10329
10364
  startedBy: opts.startedBy,
@@ -10332,7 +10367,7 @@ const unifiedProviderExecutors = {
10332
10367
  });
10333
10368
  },
10334
10369
  gemini: async (opts) => {
10335
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-C-oJCLfz.cjs'); });
10370
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-iSsDFz8x.cjs'); });
10336
10371
  await runGemini({
10337
10372
  credentials: opts.credentials,
10338
10373
  startedBy: opts.startedBy
@@ -10415,7 +10450,7 @@ function shouldRunMainClaudeFlow(opts) {
10415
10450
  return;
10416
10451
  } else if (subcommand === "runtime") {
10417
10452
  if (args[1] === "providers") {
10418
- const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-jYweihkY.cjs'); });
10453
+ const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-CAZ2gxud.cjs'); });
10419
10454
  console.log(renderRuntimeProviders());
10420
10455
  return;
10421
10456
  }
@@ -10604,8 +10639,8 @@ function shouldRunMainClaudeFlow(opts) {
10604
10639
  const projectId = args[3];
10605
10640
  try {
10606
10641
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
10607
- const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-oHFJbsvr.cjs'); });
10608
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-CleaBHoF.cjs'); }).then(function (n) { return n.api; });
10642
+ const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-CQ1ub64T.cjs'); });
10643
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-BUAppqAe.cjs'); }).then(function (n) { return n.api; });
10609
10644
  let userEmail = void 0;
10610
10645
  try {
10611
10646
  const credentials = await readCredentials2();