happy-imou-cloud 2.1.30 → 2.1.32

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 (25) hide show
  1. package/dist/{BaseReasoningProcessor-Ch9R4qmn.cjs → BaseReasoningProcessor-CQQrYyo3.cjs} +4 -3
  2. package/dist/{BaseReasoningProcessor-C1iacoJW.mjs → BaseReasoningProcessor-CfibmGoR.mjs} +4 -3
  3. package/dist/{ProviderSelectionHandler-2siFKlgs.mjs → ProviderSelectionHandler-C1q60HP6.mjs} +2 -2
  4. package/dist/{ProviderSelectionHandler-Dx6x0Nd4.cjs → ProviderSelectionHandler-D9Bd_S25.cjs} +2 -2
  5. package/dist/{api-C68U-kRs.mjs → api-DIFbsA6t.mjs} +21 -3
  6. package/dist/{api-DK1gyZAZ.cjs → api-DeDVledu.cjs} +21 -3
  7. package/dist/{command-Cb9nikZh.cjs → command-Cl7kVs7K.cjs} +2 -2
  8. package/dist/{command-D32x08k9.mjs → command-ZJ5yPOv4.mjs} +2 -2
  9. package/dist/{index-DQ76ZTNL.mjs → index-CFH8qcTw.mjs} +209 -21
  10. package/dist/{index-BLeiCte-.cjs → index-CT1dgGsX.cjs} +211 -23
  11. package/dist/index.cjs +2 -2
  12. package/dist/index.mjs +2 -2
  13. package/dist/lib.cjs +1 -1
  14. package/dist/lib.d.cts +30 -0
  15. package/dist/lib.d.mts +30 -0
  16. package/dist/lib.mjs +1 -1
  17. package/dist/{registerKillSessionHandler-DD9uUk4w.cjs → registerKillSessionHandler-9O3r5bEa.cjs} +18 -5
  18. package/dist/{registerKillSessionHandler-CadrzRgP.mjs → registerKillSessionHandler-DxpGgu6u.mjs} +18 -5
  19. package/dist/{runClaude-U9sxsnU-.cjs → runClaude-BmW-_Yrl.cjs} +8 -6
  20. package/dist/{runClaude-CkY6XYJa.mjs → runClaude-BvRjHUgF.mjs} +8 -6
  21. package/dist/{runCodex-C6kV0jfX.mjs → runCodex-B-B9MfOf.mjs} +21 -12
  22. package/dist/{runCodex-Beikmv-L.cjs → runCodex-dmjiaB1v.cjs} +21 -12
  23. package/dist/{runGemini-IEzJdhc-.mjs → runGemini-B9W7nfow.mjs} +4 -4
  24. package/dist/{runGemini-BTyqf5MR.cjs → runGemini-CyERhKhw.cjs} +4 -4
  25. package/package.json +1 -1
package/dist/lib.d.mts CHANGED
@@ -291,6 +291,7 @@ type RawJSONLines = z.infer<typeof RawJSONLinesSchema>;
291
291
  declare const HappyOrgTurnReportSchema: z.ZodObject<{
292
292
  taskId: z.ZodString;
293
293
  organizationId: z.ZodString;
294
+ organizationRootPath: z.ZodNullable<z.ZodOptional<z.ZodString>>;
294
295
  memberAgentId: z.ZodString;
295
296
  supervisorAgentId: z.ZodString;
296
297
  positionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
@@ -302,6 +303,7 @@ declare const HappyOrgTurnReportSchema: z.ZodObject<{
302
303
  blockerCode: z.ZodNullable<z.ZodString>;
303
304
  decisionNeeded: z.ZodNullable<z.ZodString>;
304
305
  targetArtifact: z.ZodNullable<z.ZodString>;
306
+ accessChannelState: z.ZodNullable<z.ZodEnum<["ok", "reattach_required", "runtime_replaced"]>>;
305
307
  repeatFingerprint: z.ZodNullable<z.ZodString>;
306
308
  replyContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
307
309
  dispatchId: z.ZodString;
@@ -355,7 +357,9 @@ declare const HappyOrgTurnReportSchema: z.ZodObject<{
355
357
  blockerCode: string | null;
356
358
  decisionNeeded: string | null;
357
359
  targetArtifact: string | null;
360
+ accessChannelState: "ok" | "reattach_required" | "runtime_replaced" | null;
358
361
  repeatFingerprint: string | null;
362
+ organizationRootPath?: string | null | undefined;
359
363
  positionId?: string | null | undefined;
360
364
  responsibilityId?: string | null | undefined;
361
365
  replyContext?: {
@@ -384,7 +388,9 @@ declare const HappyOrgTurnReportSchema: z.ZodObject<{
384
388
  blockerCode: string | null;
385
389
  decisionNeeded: string | null;
386
390
  targetArtifact: string | null;
391
+ accessChannelState: "ok" | "reattach_required" | "runtime_replaced" | null;
387
392
  repeatFingerprint: string | null;
393
+ organizationRootPath?: string | null | undefined;
388
394
  positionId?: string | null | undefined;
389
395
  responsibilityId?: string | null | undefined;
390
396
  replyContext?: {
@@ -408,6 +414,7 @@ declare const HappyOrgMetadataSchema: z.ZodObject<{
408
414
  taskContext: z.ZodOptional<z.ZodObject<{
409
415
  taskId: z.ZodString;
410
416
  organizationId: z.ZodString;
417
+ organizationRootPath: z.ZodNullable<z.ZodOptional<z.ZodString>>;
411
418
  memberAgentId: z.ZodString;
412
419
  supervisorAgentId: z.ZodString;
413
420
  positionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
@@ -417,6 +424,7 @@ declare const HappyOrgMetadataSchema: z.ZodObject<{
417
424
  organizationId: string;
418
425
  memberAgentId: string;
419
426
  supervisorAgentId: string;
427
+ organizationRootPath?: string | null | undefined;
420
428
  positionId?: string | null | undefined;
421
429
  responsibilityId?: string | null | undefined;
422
430
  }, {
@@ -424,6 +432,7 @@ declare const HappyOrgMetadataSchema: z.ZodObject<{
424
432
  organizationId: string;
425
433
  memberAgentId: string;
426
434
  supervisorAgentId: string;
435
+ organizationRootPath?: string | null | undefined;
427
436
  positionId?: string | null | undefined;
428
437
  responsibilityId?: string | null | undefined;
429
438
  }>>;
@@ -550,6 +559,7 @@ declare const HappyOrgMetadataSchema: z.ZodObject<{
550
559
  lastTurnReport: z.ZodOptional<z.ZodObject<{
551
560
  taskId: z.ZodString;
552
561
  organizationId: z.ZodString;
562
+ organizationRootPath: z.ZodNullable<z.ZodOptional<z.ZodString>>;
553
563
  memberAgentId: z.ZodString;
554
564
  supervisorAgentId: z.ZodString;
555
565
  positionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
@@ -561,6 +571,7 @@ declare const HappyOrgMetadataSchema: z.ZodObject<{
561
571
  blockerCode: z.ZodNullable<z.ZodString>;
562
572
  decisionNeeded: z.ZodNullable<z.ZodString>;
563
573
  targetArtifact: z.ZodNullable<z.ZodString>;
574
+ accessChannelState: z.ZodNullable<z.ZodEnum<["ok", "reattach_required", "runtime_replaced"]>>;
564
575
  repeatFingerprint: z.ZodNullable<z.ZodString>;
565
576
  replyContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
566
577
  dispatchId: z.ZodString;
@@ -614,7 +625,9 @@ declare const HappyOrgMetadataSchema: z.ZodObject<{
614
625
  blockerCode: string | null;
615
626
  decisionNeeded: string | null;
616
627
  targetArtifact: string | null;
628
+ accessChannelState: "ok" | "reattach_required" | "runtime_replaced" | null;
617
629
  repeatFingerprint: string | null;
630
+ organizationRootPath?: string | null | undefined;
618
631
  positionId?: string | null | undefined;
619
632
  responsibilityId?: string | null | undefined;
620
633
  replyContext?: {
@@ -643,7 +656,9 @@ declare const HappyOrgMetadataSchema: z.ZodObject<{
643
656
  blockerCode: string | null;
644
657
  decisionNeeded: string | null;
645
658
  targetArtifact: string | null;
659
+ accessChannelState: "ok" | "reattach_required" | "runtime_replaced" | null;
646
660
  repeatFingerprint: string | null;
661
+ organizationRootPath?: string | null | undefined;
647
662
  positionId?: string | null | undefined;
648
663
  responsibilityId?: string | null | undefined;
649
664
  replyContext?: {
@@ -668,6 +683,7 @@ declare const HappyOrgMetadataSchema: z.ZodObject<{
668
683
  organizationId: string;
669
684
  memberAgentId: string;
670
685
  supervisorAgentId: string;
686
+ organizationRootPath?: string | null | undefined;
671
687
  positionId?: string | null | undefined;
672
688
  responsibilityId?: string | null | undefined;
673
689
  } | undefined;
@@ -724,7 +740,9 @@ declare const HappyOrgMetadataSchema: z.ZodObject<{
724
740
  blockerCode: string | null;
725
741
  decisionNeeded: string | null;
726
742
  targetArtifact: string | null;
743
+ accessChannelState: "ok" | "reattach_required" | "runtime_replaced" | null;
727
744
  repeatFingerprint: string | null;
745
+ organizationRootPath?: string | null | undefined;
728
746
  positionId?: string | null | undefined;
729
747
  responsibilityId?: string | null | undefined;
730
748
  replyContext?: {
@@ -749,6 +767,7 @@ declare const HappyOrgMetadataSchema: z.ZodObject<{
749
767
  organizationId: string;
750
768
  memberAgentId: string;
751
769
  supervisorAgentId: string;
770
+ organizationRootPath?: string | null | undefined;
752
771
  positionId?: string | null | undefined;
753
772
  responsibilityId?: string | null | undefined;
754
773
  } | undefined;
@@ -805,7 +824,9 @@ declare const HappyOrgMetadataSchema: z.ZodObject<{
805
824
  blockerCode: string | null;
806
825
  decisionNeeded: string | null;
807
826
  targetArtifact: string | null;
827
+ accessChannelState: "ok" | "reattach_required" | "runtime_replaced" | null;
808
828
  repeatFingerprint: string | null;
829
+ organizationRootPath?: string | null | undefined;
809
830
  positionId?: string | null | undefined;
810
831
  responsibilityId?: string | null | undefined;
811
832
  replyContext?: {
@@ -1982,6 +2003,7 @@ declare const UserMessageSchema: z.ZodObject<{
1982
2003
  taskContext: z.ZodOptional<z.ZodObject<{
1983
2004
  taskId: z.ZodString;
1984
2005
  organizationId: z.ZodString;
2006
+ organizationRootPath: z.ZodNullable<z.ZodOptional<z.ZodString>>;
1985
2007
  memberAgentId: z.ZodString;
1986
2008
  supervisorAgentId: z.ZodString;
1987
2009
  positionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
@@ -1991,6 +2013,7 @@ declare const UserMessageSchema: z.ZodObject<{
1991
2013
  organizationId: string;
1992
2014
  memberAgentId: string;
1993
2015
  supervisorAgentId: string;
2016
+ organizationRootPath?: string | null | undefined;
1994
2017
  positionId?: string | null | undefined;
1995
2018
  responsibilityId?: string | null | undefined;
1996
2019
  }, {
@@ -1998,6 +2021,7 @@ declare const UserMessageSchema: z.ZodObject<{
1998
2021
  organizationId: string;
1999
2022
  memberAgentId: string;
2000
2023
  supervisorAgentId: string;
2024
+ organizationRootPath?: string | null | undefined;
2001
2025
  positionId?: string | null | undefined;
2002
2026
  responsibilityId?: string | null | undefined;
2003
2027
  }>>;
@@ -2045,6 +2069,7 @@ declare const UserMessageSchema: z.ZodObject<{
2045
2069
  organizationId: string;
2046
2070
  memberAgentId: string;
2047
2071
  supervisorAgentId: string;
2072
+ organizationRootPath?: string | null | undefined;
2048
2073
  positionId?: string | null | undefined;
2049
2074
  responsibilityId?: string | null | undefined;
2050
2075
  } | undefined;
@@ -2068,6 +2093,7 @@ declare const UserMessageSchema: z.ZodObject<{
2068
2093
  organizationId: string;
2069
2094
  memberAgentId: string;
2070
2095
  supervisorAgentId: string;
2096
+ organizationRootPath?: string | null | undefined;
2071
2097
  positionId?: string | null | undefined;
2072
2098
  responsibilityId?: string | null | undefined;
2073
2099
  } | undefined;
@@ -2101,6 +2127,7 @@ declare const UserMessageSchema: z.ZodObject<{
2101
2127
  organizationId: string;
2102
2128
  memberAgentId: string;
2103
2129
  supervisorAgentId: string;
2130
+ organizationRootPath?: string | null | undefined;
2104
2131
  positionId?: string | null | undefined;
2105
2132
  responsibilityId?: string | null | undefined;
2106
2133
  } | undefined;
@@ -2134,6 +2161,7 @@ declare const UserMessageSchema: z.ZodObject<{
2134
2161
  organizationId: string;
2135
2162
  memberAgentId: string;
2136
2163
  supervisorAgentId: string;
2164
+ organizationRootPath?: string | null | undefined;
2137
2165
  positionId?: string | null | undefined;
2138
2166
  responsibilityId?: string | null | undefined;
2139
2167
  } | undefined;
@@ -2175,6 +2203,7 @@ declare const UserMessageSchema: z.ZodObject<{
2175
2203
  organizationId: string;
2176
2204
  memberAgentId: string;
2177
2205
  supervisorAgentId: string;
2206
+ organizationRootPath?: string | null | undefined;
2178
2207
  positionId?: string | null | undefined;
2179
2208
  responsibilityId?: string | null | undefined;
2180
2209
  } | undefined;
@@ -2216,6 +2245,7 @@ declare const UserMessageSchema: z.ZodObject<{
2216
2245
  organizationId: string;
2217
2246
  memberAgentId: string;
2218
2247
  supervisorAgentId: string;
2248
+ organizationRootPath?: string | null | undefined;
2219
2249
  positionId?: string | null | undefined;
2220
2250
  responsibilityId?: string | null | undefined;
2221
2251
  } | undefined;
package/dist/lib.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-C68U-kRs.mjs';
1
+ export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-DIFbsA6t.mjs';
2
2
  export { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
3
3
  import 'axios';
4
4
  import 'chalk';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BLeiCte-.cjs');
4
- var persistence = require('./api-DK1gyZAZ.cjs');
3
+ var index = require('./index-CT1dgGsX.cjs');
4
+ var persistence = require('./api-DeDVledu.cjs');
5
5
  var node_crypto = require('node:crypto');
6
6
  var path = require('node:path');
7
7
  var crypto = require('crypto');
@@ -439,6 +439,13 @@ function normalizeOptionalText(value) {
439
439
  const trimmed = value.trim();
440
440
  return trimmed.length > 0 ? trimmed : null;
441
441
  }
442
+ function normalizeAccessChannelState(value) {
443
+ const normalized = normalizeSingleLineText(value)?.toLowerCase();
444
+ if (normalized === "ok" || normalized === "reattach_required" || normalized === "runtime_replaced") {
445
+ return normalized;
446
+ }
447
+ return null;
448
+ }
442
449
  function normalizeSummaryText(value) {
443
450
  const normalized = normalizeOptionalText(value);
444
451
  return normalized ? normalized.replace(/\s+/g, " ").slice(0, persistence.HAPPY_ORG_SUMMARY_MAX_LENGTH) : null;
@@ -965,7 +972,8 @@ function normalizeTurnReportDraft(draft) {
965
972
  interventionType: inferInterventionType(draft),
966
973
  blockerCode: normalizeOptionalText(draft?.blockerCode),
967
974
  decisionNeeded: normalizeOptionalText(draft?.decisionNeeded),
968
- targetArtifact: normalizeOptionalText(draft?.targetArtifact)
975
+ targetArtifact: normalizeOptionalText(draft?.targetArtifact),
976
+ accessChannelState: normalizeAccessChannelState(draft?.accessChannelState)
969
977
  };
970
978
  }
971
979
  function stripCodeFence(text) {
@@ -996,7 +1004,8 @@ function extractTaggedTurnReport(text) {
996
1004
  interventionType: normalizeOptionalText(parsed.interventionType),
997
1005
  blockerCode: normalizeOptionalText(parsed.blockerCode),
998
1006
  decisionNeeded: normalizeOptionalText(parsed.decisionNeeded),
999
- targetArtifact: normalizeOptionalText(parsed.targetArtifact)
1007
+ targetArtifact: normalizeOptionalText(parsed.targetArtifact),
1008
+ accessChannelState: normalizeAccessChannelState(parsed.accessChannelState)
1000
1009
  };
1001
1010
  } catch {
1002
1011
  draft = null;
@@ -1073,6 +1082,7 @@ function buildHappyOrgTurnPrompt(prompt, turn) {
1073
1082
  "When you send the formal dispatch business ack in your visible response, include exactly one raw key=value block (no markdown code fence) using this shape:",
1074
1083
  `dispatch_id=${turn.replyContext.dispatchId}`,
1075
1084
  `scope=${turn.replyContext.scope}`,
1085
+ `agent_id=${turn.context.memberAgentId}`,
1076
1086
  turn.replyContext.positionId ? `position_id=${turn.replyContext.positionId}` : null,
1077
1087
  turn.replyContext.responsibilityId ? `responsibility_id=${turn.replyContext.responsibilityId}` : null,
1078
1088
  `task_ack=${turn.context.taskId}`,
@@ -1091,15 +1101,17 @@ function buildHappyOrgTurnPrompt(prompt, turn) {
1091
1101
  "[HAPPY_ORG_TASK_CONTEXT]",
1092
1102
  `taskId=${turn.context.taskId}`,
1093
1103
  `organizationId=${turn.context.organizationId}`,
1104
+ turn.context.organizationRootPath ? `organizationRootPath=${turn.context.organizationRootPath}` : null,
1094
1105
  `memberAgentId=${turn.context.memberAgentId}`,
1095
1106
  `supervisorAgentId=${turn.context.supervisorAgentId}`,
1096
1107
  turn.context.positionId ? `positionId=${turn.context.positionId}` : null,
1097
1108
  turn.context.responsibilityId ? `responsibilityId=${turn.context.responsibilityId}` : null,
1098
1109
  "Stay on this exact task for the whole turn.",
1099
1110
  "End your response with exactly one raw JSON block inside these tags and do not wrap it in a markdown code fence:",
1100
- `<${persistence.HAPPY_ORG_TURN_REPORT_TAG}>{"turnStatus":"turn_update","summary":"short task-board summary","interventionType":"none","blockerCode":null,"decisionNeeded":null,"targetArtifact":null}</${persistence.HAPPY_ORG_TURN_REPORT_TAG}>`,
1111
+ `<${persistence.HAPPY_ORG_TURN_REPORT_TAG}>{"turnStatus":"turn_update","summary":"short task-board summary","interventionType":"none","blockerCode":null,"decisionNeeded":null,"targetArtifact":null,"accessChannelState":"ok"}</${persistence.HAPPY_ORG_TURN_REPORT_TAG}>`,
1101
1112
  "Allowed turnStatus values in the JSON block: turn_update, task_complete.",
1102
1113
  "Allowed interventionType values: none, review_needed, blocker, decision_needed.",
1114
+ "Allowed accessChannelState values: ok, reattach_required, runtime_replaced.",
1103
1115
  "Use turnStatus=task_complete only when you believe the assigned task is finished and ready for CEO acceptance.",
1104
1116
  "If turnStatus=task_complete, the task will wait for CEO close; do not treat it as automatically closed.",
1105
1117
  "If turnStatus=task_complete, interventionType must be review_needed.",
@@ -1276,6 +1288,7 @@ function finalizeHappyOrgTurn(opts) {
1276
1288
  blockerCode: normalizedDraft.blockerCode ?? null,
1277
1289
  decisionNeeded: normalizedDraft.decisionNeeded ?? null,
1278
1290
  targetArtifact: normalizedDraft.targetArtifact ?? null,
1291
+ accessChannelState: normalizedDraft.accessChannelState ?? "ok",
1279
1292
  repeatFingerprint: buildRepeatFingerprint(
1280
1293
  queuedTurn.context,
1281
1294
  normalizedDraft.blockerCode ?? null,
@@ -1,5 +1,5 @@
1
- import { k as initialMachineMetadata, R as RuntimeShell, f as formatDisplayMessage, l as resolveCanonicalToolNameV2 } from './index-DQ76ZTNL.mjs';
2
- import { r as readSettings, H as HeadTailPreviewBuffer, d as HAPPY_ORG_TURN_REPORT_TAG, e as HAPPY_ORG_SUMMARY_MAX_LENGTH, f as HAPPY_ORG_REPEAT_THRESHOLD, l as logger } from './api-C68U-kRs.mjs';
1
+ import { k as initialMachineMetadata, R as RuntimeShell, f as formatDisplayMessage, l as resolveCanonicalToolNameV2 } from './index-CFH8qcTw.mjs';
2
+ import { r as readSettings, H as HeadTailPreviewBuffer, d as HAPPY_ORG_TURN_REPORT_TAG, e as HAPPY_ORG_SUMMARY_MAX_LENGTH, f as HAPPY_ORG_REPEAT_THRESHOLD, l as logger } from './api-DIFbsA6t.mjs';
3
3
  import { randomUUID } from 'node:crypto';
4
4
  import { basename } from 'node:path';
5
5
  import { createHash } from 'crypto';
@@ -437,6 +437,13 @@ function normalizeOptionalText(value) {
437
437
  const trimmed = value.trim();
438
438
  return trimmed.length > 0 ? trimmed : null;
439
439
  }
440
+ function normalizeAccessChannelState(value) {
441
+ const normalized = normalizeSingleLineText(value)?.toLowerCase();
442
+ if (normalized === "ok" || normalized === "reattach_required" || normalized === "runtime_replaced") {
443
+ return normalized;
444
+ }
445
+ return null;
446
+ }
440
447
  function normalizeSummaryText(value) {
441
448
  const normalized = normalizeOptionalText(value);
442
449
  return normalized ? normalized.replace(/\s+/g, " ").slice(0, HAPPY_ORG_SUMMARY_MAX_LENGTH) : null;
@@ -963,7 +970,8 @@ function normalizeTurnReportDraft(draft) {
963
970
  interventionType: inferInterventionType(draft),
964
971
  blockerCode: normalizeOptionalText(draft?.blockerCode),
965
972
  decisionNeeded: normalizeOptionalText(draft?.decisionNeeded),
966
- targetArtifact: normalizeOptionalText(draft?.targetArtifact)
973
+ targetArtifact: normalizeOptionalText(draft?.targetArtifact),
974
+ accessChannelState: normalizeAccessChannelState(draft?.accessChannelState)
967
975
  };
968
976
  }
969
977
  function stripCodeFence(text) {
@@ -994,7 +1002,8 @@ function extractTaggedTurnReport(text) {
994
1002
  interventionType: normalizeOptionalText(parsed.interventionType),
995
1003
  blockerCode: normalizeOptionalText(parsed.blockerCode),
996
1004
  decisionNeeded: normalizeOptionalText(parsed.decisionNeeded),
997
- targetArtifact: normalizeOptionalText(parsed.targetArtifact)
1005
+ targetArtifact: normalizeOptionalText(parsed.targetArtifact),
1006
+ accessChannelState: normalizeAccessChannelState(parsed.accessChannelState)
998
1007
  };
999
1008
  } catch {
1000
1009
  draft = null;
@@ -1071,6 +1080,7 @@ function buildHappyOrgTurnPrompt(prompt, turn) {
1071
1080
  "When you send the formal dispatch business ack in your visible response, include exactly one raw key=value block (no markdown code fence) using this shape:",
1072
1081
  `dispatch_id=${turn.replyContext.dispatchId}`,
1073
1082
  `scope=${turn.replyContext.scope}`,
1083
+ `agent_id=${turn.context.memberAgentId}`,
1074
1084
  turn.replyContext.positionId ? `position_id=${turn.replyContext.positionId}` : null,
1075
1085
  turn.replyContext.responsibilityId ? `responsibility_id=${turn.replyContext.responsibilityId}` : null,
1076
1086
  `task_ack=${turn.context.taskId}`,
@@ -1089,15 +1099,17 @@ function buildHappyOrgTurnPrompt(prompt, turn) {
1089
1099
  "[HAPPY_ORG_TASK_CONTEXT]",
1090
1100
  `taskId=${turn.context.taskId}`,
1091
1101
  `organizationId=${turn.context.organizationId}`,
1102
+ turn.context.organizationRootPath ? `organizationRootPath=${turn.context.organizationRootPath}` : null,
1092
1103
  `memberAgentId=${turn.context.memberAgentId}`,
1093
1104
  `supervisorAgentId=${turn.context.supervisorAgentId}`,
1094
1105
  turn.context.positionId ? `positionId=${turn.context.positionId}` : null,
1095
1106
  turn.context.responsibilityId ? `responsibilityId=${turn.context.responsibilityId}` : null,
1096
1107
  "Stay on this exact task for the whole turn.",
1097
1108
  "End your response with exactly one raw JSON block inside these tags and do not wrap it in a markdown code fence:",
1098
- `<${HAPPY_ORG_TURN_REPORT_TAG}>{"turnStatus":"turn_update","summary":"short task-board summary","interventionType":"none","blockerCode":null,"decisionNeeded":null,"targetArtifact":null}</${HAPPY_ORG_TURN_REPORT_TAG}>`,
1109
+ `<${HAPPY_ORG_TURN_REPORT_TAG}>{"turnStatus":"turn_update","summary":"short task-board summary","interventionType":"none","blockerCode":null,"decisionNeeded":null,"targetArtifact":null,"accessChannelState":"ok"}</${HAPPY_ORG_TURN_REPORT_TAG}>`,
1099
1110
  "Allowed turnStatus values in the JSON block: turn_update, task_complete.",
1100
1111
  "Allowed interventionType values: none, review_needed, blocker, decision_needed.",
1112
+ "Allowed accessChannelState values: ok, reattach_required, runtime_replaced.",
1101
1113
  "Use turnStatus=task_complete only when you believe the assigned task is finished and ready for CEO acceptance.",
1102
1114
  "If turnStatus=task_complete, the task will wait for CEO close; do not treat it as automatically closed.",
1103
1115
  "If turnStatus=task_complete, interventionType must be review_needed.",
@@ -1274,6 +1286,7 @@ function finalizeHappyOrgTurn(opts) {
1274
1286
  blockerCode: normalizedDraft.blockerCode ?? null,
1275
1287
  decisionNeeded: normalizedDraft.decisionNeeded ?? null,
1276
1288
  targetArtifact: normalizedDraft.targetArtifact ?? null,
1289
+ accessChannelState: normalizedDraft.accessChannelState ?? "ok",
1277
1290
  repeatFingerprint: buildRepeatFingerprint(
1278
1291
  queuedTurn.context,
1279
1292
  normalizedDraft.blockerCode ?? null,
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var node_crypto = require('node:crypto');
4
- var persistence = require('./api-DK1gyZAZ.cjs');
4
+ var persistence = require('./api-DeDVledu.cjs');
5
5
  require('cross-spawn');
6
6
  require('@agentclientprotocol/sdk');
7
- var index = require('./index-BLeiCte-.cjs');
7
+ var index = require('./index-CT1dgGsX.cjs');
8
8
  require('ps-list');
9
9
  require('fs');
10
10
  require('path');
@@ -25,9 +25,9 @@ require('tweetnacl');
25
25
  require('open');
26
26
  var React = require('react');
27
27
  var ink = require('ink');
28
- var ProviderSelectionHandler = require('./ProviderSelectionHandler-Dx6x0Nd4.cjs');
28
+ var ProviderSelectionHandler = require('./ProviderSelectionHandler-D9Bd_S25.cjs');
29
29
  var types = require('./types-DVk3crez.cjs');
30
- var registerKillSessionHandler = require('./registerKillSessionHandler-DD9uUk4w.cjs');
30
+ var registerKillSessionHandler = require('./registerKillSessionHandler-9O3r5bEa.cjs');
31
31
  require('socket.io-client');
32
32
  require('expo-server-sdk');
33
33
  var node_util = require('node:util');
@@ -3321,7 +3321,7 @@ function bindClaudeUserMessageQueue(opts) {
3321
3321
  async function runClaude(credentials, options = {}) {
3322
3322
  persistence.logger.debug(`[CLAUDE] ===== CLAUDE MODE STARTING =====`);
3323
3323
  persistence.logger.debug(`[CLAUDE] This is the Claude agent, NOT Gemini`);
3324
- const workingDirectory = process.cwd();
3324
+ const requestedWorkingDirectory = process.cwd();
3325
3325
  const sessionTag = node_crypto.randomUUID();
3326
3326
  persistence.logger.debugLargeJson("[START] Happy process started", index.getEnvironmentInfo());
3327
3327
  persistence.logger.debug(`[START] Options: startedBy=${options.startedBy}, startingMode=${options.startingMode}`);
@@ -3347,8 +3347,10 @@ async function runClaude(credentials, options = {}) {
3347
3347
  const { state, metadata } = index.createSessionMetadata({
3348
3348
  flavor: "claude",
3349
3349
  machineId,
3350
- startedBy: options.startedBy
3350
+ startedBy: options.startedBy,
3351
+ path: requestedWorkingDirectory
3351
3352
  });
3353
+ const workingDirectory = metadata.path;
3352
3354
  let response = null;
3353
3355
  try {
3354
3356
  response = await api.getOrCreateSession({ tag: sessionTag, metadata, state });
@@ -1,8 +1,8 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { l as logger, g as backoff, h as delay, j as AsyncLock, c as configuration, s as startOfflineReconnection, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-C68U-kRs.mjs';
2
+ import { l as logger, g as backoff, h as delay, j as AsyncLock, c as configuration, s as startOfflineReconnection, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-DIFbsA6t.mjs';
3
3
  import 'cross-spawn';
4
4
  import '@agentclientprotocol/sdk';
5
- import { m as getProjectPath, F as Future, n as claudeLocal, E as ExitCodeError, o as trimIdent, q as createClaudeBackend, f as formatDisplayMessage, t as truncateDisplayMessage, u as claudeCheckSession, w as projectPath, x as mapToClaudeMode, P as PushableAsyncIterable, y as query, A as AbortError, e as stopCaffeinate, p as publishSessionRegistration, z as getEnvironmentInfo, a as createSessionMetadata, B as startCaffeinate, b as closeProviderSession } from './index-DQ76ZTNL.mjs';
5
+ import { m as getProjectPath, F as Future, n as claudeLocal, E as ExitCodeError, o as trimIdent, q as createClaudeBackend, f as formatDisplayMessage, t as truncateDisplayMessage, u as claudeCheckSession, w as projectPath, x as mapToClaudeMode, P as PushableAsyncIterable, y as query, A as AbortError, e as stopCaffeinate, p as publishSessionRegistration, z as getEnvironmentInfo, a as createSessionMetadata, B as startCaffeinate, b as closeProviderSession } from './index-CFH8qcTw.mjs';
6
6
  import 'ps-list';
7
7
  import 'fs';
8
8
  import 'path';
@@ -23,9 +23,9 @@ import 'tweetnacl';
23
23
  import 'open';
24
24
  import React, { useState, useRef, useEffect, useCallback } from 'react';
25
25
  import { useStdout, useInput, Box, Text, render } from 'ink';
26
- import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-2siFKlgs.mjs';
26
+ import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-C1q60HP6.mjs';
27
27
  import { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
28
- import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, i as finalizeHappyOrgTurnWithBusinessAck, l as launchRuntimeHandleWithFactoryResult, j as renderOutputPreview, m as forwardAgentMessageToProviderSession, s as syncControlledByUserState, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, h as hashObject, c as registerKillSessionHandler } from './registerKillSessionHandler-CadrzRgP.mjs';
28
+ import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, i as finalizeHappyOrgTurnWithBusinessAck, l as launchRuntimeHandleWithFactoryResult, j as renderOutputPreview, m as forwardAgentMessageToProviderSession, s as syncControlledByUserState, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, h as hashObject, c as registerKillSessionHandler } from './registerKillSessionHandler-DxpGgu6u.mjs';
29
29
  import 'socket.io-client';
30
30
  import 'expo-server-sdk';
31
31
  import { isDeepStrictEqual } from 'node:util';
@@ -3319,7 +3319,7 @@ function bindClaudeUserMessageQueue(opts) {
3319
3319
  async function runClaude(credentials, options = {}) {
3320
3320
  logger.debug(`[CLAUDE] ===== CLAUDE MODE STARTING =====`);
3321
3321
  logger.debug(`[CLAUDE] This is the Claude agent, NOT Gemini`);
3322
- const workingDirectory = process.cwd();
3322
+ const requestedWorkingDirectory = process.cwd();
3323
3323
  const sessionTag = randomUUID();
3324
3324
  logger.debugLargeJson("[START] Happy process started", getEnvironmentInfo());
3325
3325
  logger.debug(`[START] Options: startedBy=${options.startedBy}, startingMode=${options.startingMode}`);
@@ -3345,8 +3345,10 @@ async function runClaude(credentials, options = {}) {
3345
3345
  const { state, metadata } = createSessionMetadata({
3346
3346
  flavor: "claude",
3347
3347
  machineId,
3348
- startedBy: options.startedBy
3348
+ startedBy: options.startedBy,
3349
+ path: requestedWorkingDirectory
3349
3350
  });
3351
+ const workingDirectory = metadata.path;
3350
3352
  let response = null;
3351
3353
  try {
3352
3354
  response = await api.getOrCreateSession({ tag: sessionTag, metadata, state });
@@ -1,6 +1,6 @@
1
- import { p as preserveSessionRuntimeMetadata, l as logger, b as connectionState, A as ApiClient } from './api-C68U-kRs.mjs';
2
- import { B as BasePermissionHandler, h as hashObject, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, i as finalizeHappyOrgTurnWithBusinessAck, c as registerKillSessionHandler, l as launchRuntimeHandleWithFactoryResult, j as renderOutputPreview, k as inferToolResultError, m as forwardAgentMessageToProviderSession, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, r as resolveHappyOrgQueuedTurn, s as syncControlledByUserState } from './registerKillSessionHandler-CadrzRgP.mjs';
3
- import { f as formatDisplayMessage, v as validateCodexAcpSpawn, h as createCodexBackend, t as truncateDisplayMessage, b as closeProviderSession, e as stopCaffeinate, i as readManagedSessionTag, j as resolveManagedSessionTag } from './index-DQ76ZTNL.mjs';
1
+ import { p as preserveSessionRuntimeMetadata, l as logger, b as connectionState, A as ApiClient } from './api-DIFbsA6t.mjs';
2
+ import { B as BasePermissionHandler, h as hashObject, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, i as finalizeHappyOrgTurnWithBusinessAck, c as registerKillSessionHandler, l as launchRuntimeHandleWithFactoryResult, j as renderOutputPreview, k as inferToolResultError, m as forwardAgentMessageToProviderSession, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, r as resolveHappyOrgQueuedTurn, s as syncControlledByUserState } from './registerKillSessionHandler-DxpGgu6u.mjs';
3
+ import { f as formatDisplayMessage, v as validateCodexAcpSpawn, h as createCodexBackend, t as truncateDisplayMessage, b as closeProviderSession, e as stopCaffeinate, i as readManagedSessionTag, j as resolveManagedSessionTag } from './index-CFH8qcTw.mjs';
4
4
  import 'cross-spawn';
5
5
  import '@agentclientprotocol/sdk';
6
6
  import { randomUUID } from 'node:crypto';
@@ -24,8 +24,8 @@ import 'tweetnacl';
24
24
  import 'open';
25
25
  import React, { useState, useRef, useEffect, useCallback } from 'react';
26
26
  import { useStdout, useInput, Box, Text, render } from 'ink';
27
- import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-2siFKlgs.mjs';
28
- import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-C1iacoJW.mjs';
27
+ import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-C1q60HP6.mjs';
28
+ import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-CfibmGoR.mjs';
29
29
  import 'zod';
30
30
  import 'socket.io-client';
31
31
  import 'expo-server-sdk';
@@ -153,6 +153,7 @@ function createCodexRuntimeSession(options) {
153
153
  class CodexSession {
154
154
  path;
155
155
  logPath;
156
+ startupRolePrompt;
156
157
  api;
157
158
  client;
158
159
  runtimeSession;
@@ -173,6 +174,7 @@ class CodexSession {
173
174
  this.path = opts.path;
174
175
  this.api = opts.api;
175
176
  this.client = opts.client;
177
+ this.startupRolePrompt = opts.startupRolePrompt ?? null;
176
178
  this.protocolDescriptor = opts.protocolDescriptor ?? null;
177
179
  this.protocolStateSources = opts.protocolStateSources ?? [];
178
180
  this.userObserver = opts.userObserver ?? null;
@@ -1164,24 +1166,30 @@ async function codexRemoteLauncher(session) {
1164
1166
  try {
1165
1167
  turnInFlight = true;
1166
1168
  shouldCommitAccumulatedResponse = false;
1169
+ const isNewRuntimeSession = runtimeHandle === null;
1167
1170
  const activeRuntimeHandle = runtimeHandle ?? await createRuntimeHandle(message.mode);
1168
1171
  if (!activeRuntimeHandle) {
1169
1172
  throw new Error("Failed to create Codex ACP backend");
1170
1173
  }
1171
1174
  session.onThinkingChange(true);
1172
- let promptToSend = message.message;
1175
+ const promptPreludeParts = [];
1176
+ if (isNewRuntimeSession && session.startupRolePrompt) {
1177
+ promptPreludeParts.push(session.startupRolePrompt);
1178
+ logger.debug("[Codex] Injected local startup home identity prompt into a new ACP session");
1179
+ }
1173
1180
  if (shouldInjectLargeOutputRecoveryHintOnNextSession) {
1174
- promptToSend = `${CODEX_LARGE_OUTPUT_RECOVERY_HINT}
1175
-
1176
- ${promptToSend}`;
1181
+ promptPreludeParts.push(CODEX_LARGE_OUTPUT_RECOVERY_HINT);
1177
1182
  shouldInjectLargeOutputRecoveryHintOnNextSession = false;
1178
1183
  logger.debug("[Codex] Injected large-output recovery hint into the next session prompt");
1179
1184
  }
1180
1185
  if (shouldInjectHistoryOnNextSession && conversationHistory.hasHistory()) {
1181
1186
  const historyContext = conversationHistory.getContextForNewSession();
1182
- promptToSend = historyContext + promptToSend;
1187
+ promptPreludeParts.push(historyContext.trim());
1183
1188
  logger.debug(`[Codex] Injected conversation history context (${historyContext.length} chars)`);
1184
1189
  }
1190
+ let promptToSend = promptPreludeParts.length > 0 ? `${promptPreludeParts.join("\n\n")}
1191
+
1192
+ ${message.message}` : message.message;
1185
1193
  if (message.mode.happyOrg) {
1186
1194
  promptToSend = buildHappyOrgTurnPrompt(promptToSend, message.mode.happyOrg);
1187
1195
  }
@@ -1434,7 +1442,7 @@ async function runCodex(opts) {
1434
1442
  }
1435
1443
  let sessionClient;
1436
1444
  let codexSession = null;
1437
- const { metadata, session: initialSession, reconnectionHandle } = await bootstrapManagedProviderSession({
1445
+ const { metadata, session: initialSession, reconnectionHandle, happyOrgStartupBinding } = await bootstrapManagedProviderSession({
1438
1446
  api,
1439
1447
  sessionTag,
1440
1448
  flavor: "codex",
@@ -1495,8 +1503,9 @@ async function runCodex(opts) {
1495
1503
  codexSession = new CodexSession({
1496
1504
  api,
1497
1505
  client: sessionClient,
1498
- path: process.cwd(),
1506
+ path: metadata.path,
1499
1507
  logPath: logger.logFilePath,
1508
+ startupRolePrompt: happyOrgStartupBinding?.identityPrompt ?? null,
1500
1509
  sessionId: null,
1501
1510
  mode: requestedStartingMode,
1502
1511
  messageQueue,
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var persistence = require('./api-DK1gyZAZ.cjs');
4
- var registerKillSessionHandler = require('./registerKillSessionHandler-DD9uUk4w.cjs');
5
- var index = require('./index-BLeiCte-.cjs');
3
+ var persistence = require('./api-DeDVledu.cjs');
4
+ var registerKillSessionHandler = require('./registerKillSessionHandler-9O3r5bEa.cjs');
5
+ var index = require('./index-CT1dgGsX.cjs');
6
6
  require('cross-spawn');
7
7
  require('@agentclientprotocol/sdk');
8
8
  var node_crypto = require('node:crypto');
@@ -26,8 +26,8 @@ require('tweetnacl');
26
26
  require('open');
27
27
  var React = require('react');
28
28
  var ink = require('ink');
29
- var ProviderSelectionHandler = require('./ProviderSelectionHandler-Dx6x0Nd4.cjs');
30
- var BaseReasoningProcessor = require('./BaseReasoningProcessor-Ch9R4qmn.cjs');
29
+ var ProviderSelectionHandler = require('./ProviderSelectionHandler-D9Bd_S25.cjs');
30
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-CQQrYyo3.cjs');
31
31
  require('zod');
32
32
  require('socket.io-client');
33
33
  require('expo-server-sdk');
@@ -155,6 +155,7 @@ function createCodexRuntimeSession(options) {
155
155
  class CodexSession {
156
156
  path;
157
157
  logPath;
158
+ startupRolePrompt;
158
159
  api;
159
160
  client;
160
161
  runtimeSession;
@@ -175,6 +176,7 @@ class CodexSession {
175
176
  this.path = opts.path;
176
177
  this.api = opts.api;
177
178
  this.client = opts.client;
179
+ this.startupRolePrompt = opts.startupRolePrompt ?? null;
178
180
  this.protocolDescriptor = opts.protocolDescriptor ?? null;
179
181
  this.protocolStateSources = opts.protocolStateSources ?? [];
180
182
  this.userObserver = opts.userObserver ?? null;
@@ -1166,24 +1168,30 @@ async function codexRemoteLauncher(session) {
1166
1168
  try {
1167
1169
  turnInFlight = true;
1168
1170
  shouldCommitAccumulatedResponse = false;
1171
+ const isNewRuntimeSession = runtimeHandle === null;
1169
1172
  const activeRuntimeHandle = runtimeHandle ?? await createRuntimeHandle(message.mode);
1170
1173
  if (!activeRuntimeHandle) {
1171
1174
  throw new Error("Failed to create Codex ACP backend");
1172
1175
  }
1173
1176
  session.onThinkingChange(true);
1174
- let promptToSend = message.message;
1177
+ const promptPreludeParts = [];
1178
+ if (isNewRuntimeSession && session.startupRolePrompt) {
1179
+ promptPreludeParts.push(session.startupRolePrompt);
1180
+ persistence.logger.debug("[Codex] Injected local startup home identity prompt into a new ACP session");
1181
+ }
1175
1182
  if (shouldInjectLargeOutputRecoveryHintOnNextSession) {
1176
- promptToSend = `${CODEX_LARGE_OUTPUT_RECOVERY_HINT}
1177
-
1178
- ${promptToSend}`;
1183
+ promptPreludeParts.push(CODEX_LARGE_OUTPUT_RECOVERY_HINT);
1179
1184
  shouldInjectLargeOutputRecoveryHintOnNextSession = false;
1180
1185
  persistence.logger.debug("[Codex] Injected large-output recovery hint into the next session prompt");
1181
1186
  }
1182
1187
  if (shouldInjectHistoryOnNextSession && conversationHistory.hasHistory()) {
1183
1188
  const historyContext = conversationHistory.getContextForNewSession();
1184
- promptToSend = historyContext + promptToSend;
1189
+ promptPreludeParts.push(historyContext.trim());
1185
1190
  persistence.logger.debug(`[Codex] Injected conversation history context (${historyContext.length} chars)`);
1186
1191
  }
1192
+ let promptToSend = promptPreludeParts.length > 0 ? `${promptPreludeParts.join("\n\n")}
1193
+
1194
+ ${message.message}` : message.message;
1187
1195
  if (message.mode.happyOrg) {
1188
1196
  promptToSend = registerKillSessionHandler.buildHappyOrgTurnPrompt(promptToSend, message.mode.happyOrg);
1189
1197
  }
@@ -1436,7 +1444,7 @@ async function runCodex(opts) {
1436
1444
  }
1437
1445
  let sessionClient;
1438
1446
  let codexSession = null;
1439
- const { metadata, session: initialSession, reconnectionHandle } = await BaseReasoningProcessor.bootstrapManagedProviderSession({
1447
+ const { metadata, session: initialSession, reconnectionHandle, happyOrgStartupBinding } = await BaseReasoningProcessor.bootstrapManagedProviderSession({
1440
1448
  api,
1441
1449
  sessionTag,
1442
1450
  flavor: "codex",
@@ -1497,8 +1505,9 @@ async function runCodex(opts) {
1497
1505
  codexSession = new CodexSession({
1498
1506
  api,
1499
1507
  client: sessionClient,
1500
- path: process.cwd(),
1508
+ path: metadata.path,
1501
1509
  logPath: persistence.logger.logFilePath,
1510
+ startupRolePrompt: happyOrgStartupBinding?.identityPrompt ?? null,
1502
1511
  sessionId: null,
1503
1512
  mode: requestedStartingMode,
1504
1513
  messageQueue,