gestalt-mobile 0.41.1 → 0.41.3

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.
@@ -41,6 +41,12 @@ export const gestaltOrgPlanAttentionDynamicTool = {
41
41
  summary: { type: 'string', minLength: 1, maxLength: 600 },
42
42
  requestedAction: { type: 'string', minLength: 1, maxLength: 600 },
43
43
  resumeCondition: { type: 'string', enum: orgPlanAttentionResumeConditions },
44
+ executorReplacement: {
45
+ type: 'object',
46
+ additionalProperties: false,
47
+ required: ['canonicalTaskName'],
48
+ properties: { canonicalTaskName: { type: 'string', pattern: '^l[1-9][0-9]*$' } },
49
+ },
44
50
  },
45
51
  oneOf: orgPlanAttentionReasons.map((reason) => ({
46
52
  properties: {
@@ -66,19 +72,31 @@ export function parseOrgPlanAttention(value) {
66
72
  requestedAction: `Satisfy the ${value.resumeCondition} resume condition, then resume or disable Autopilot.`,
67
73
  resumeCondition: value.resumeCondition,
68
74
  };
69
- if (keys.length !== 4)
75
+ if (keys.length !== 4 && keys.length !== 5)
76
+ return null;
77
+ if (keys.some((key) => ![
78
+ 'reason',
79
+ 'summary',
80
+ 'requestedAction',
81
+ 'resumeCondition',
82
+ 'executorReplacement',
83
+ ].includes(key)))
70
84
  return null;
85
+ const executorReplacement = parseExecutorReplacement(value.executorReplacement);
71
86
  if (!isReason(value.reason) ||
72
87
  !isBoundedText(value.summary, 600) ||
73
88
  !isBoundedText(value.requestedAction, 600) ||
74
89
  !isResumeCondition(value.resumeCondition) ||
75
- orgPlanAttentionResumeConditionByReason[value.reason] !== value.resumeCondition)
90
+ orgPlanAttentionResumeConditionByReason[value.reason] !== value.resumeCondition ||
91
+ (value.executorReplacement !== undefined && !executorReplacement) ||
92
+ (executorReplacement && value.reason !== 'permissionRequired'))
76
93
  return null;
77
94
  return {
78
95
  reason: value.reason,
79
96
  summary: value.summary,
80
97
  requestedAction: value.requestedAction,
81
98
  resumeCondition: value.resumeCondition,
99
+ ...(executorReplacement ? { executorReplacement } : {}),
82
100
  };
83
101
  }
84
102
  export function parseOrgPlanAttentionResponse(value) {
@@ -93,29 +111,47 @@ export function parseOrgPlanAttentionResponse(value) {
93
111
  ...(typeof value.guidance === 'string' ? { guidance: value.guidance } : {}),
94
112
  };
95
113
  }
96
- /** The only result accepted by the held app-server dynamic-tool request. */
114
+ /** Legacy human resolution payload used only for pre-acknowledgement held requests. */
97
115
  export function toOrgPlanAttentionToolResponse(response) {
98
116
  return {
99
117
  success: true,
100
118
  contentItems: [{ type: 'inputText', text: JSON.stringify(response) }],
101
119
  };
102
120
  }
121
+ /** Immediate persist-first acknowledgement returned to the dynamic-tool caller. */
122
+ export function toOrgPlanAttentionAcknowledgement(acknowledgement = { accepted: true }) {
123
+ return {
124
+ success: acknowledgement.accepted,
125
+ contentItems: [{ type: 'inputText', text: JSON.stringify(acknowledgement) }],
126
+ };
127
+ }
103
128
  export function isOrgPlanAttentionToolResponse(value) {
129
+ return parseOrgPlanAttentionToolResponse(value) !== null;
130
+ }
131
+ export function parseOrgPlanAttentionToolResponse(value) {
104
132
  if (!isRecord(value) || value.success !== true || !Array.isArray(value.contentItems))
105
- return false;
133
+ return null;
106
134
  const item = value.contentItems[0];
107
135
  if (value.contentItems.length !== 1 ||
108
136
  !isRecord(item) ||
109
137
  item.type !== 'inputText' ||
110
138
  typeof item.text !== 'string')
111
- return false;
139
+ return null;
112
140
  try {
113
- return parseOrgPlanAttentionResponse(JSON.parse(item.text)) !== null;
141
+ return parseOrgPlanAttentionResponse(JSON.parse(item.text));
114
142
  }
115
143
  catch {
116
- return false;
144
+ return null;
117
145
  }
118
146
  }
147
+ function parseExecutorReplacement(value) {
148
+ if (!isRecord(value) || Object.keys(value).length !== 1)
149
+ return null;
150
+ return typeof value.canonicalTaskName === 'string' &&
151
+ /^l[1-9][0-9]*$/.test(value.canonicalTaskName)
152
+ ? { canonicalTaskName: value.canonicalTaskName }
153
+ : null;
154
+ }
119
155
  function isReason(value) {
120
156
  return (typeof value === 'string' && orgPlanAttentionReasons.includes(value));
121
157
  }
@@ -176,7 +176,7 @@ export function parseOrgPlanCheckpoint(value) {
176
176
  };
177
177
  }
178
178
  /** Acknowledgement deliberately contains no plan path, findings, or model text. */
179
- export function toOrgPlanCheckpointToolResponse(status) {
179
+ export function toOrgPlanCheckpointToolResponse(status, failure) {
180
180
  const result = status === 'recorded'
181
181
  ? {
182
182
  status,
@@ -193,7 +193,11 @@ export function toOrgPlanCheckpointToolResponse(status) {
193
193
  }
194
194
  : {
195
195
  status,
196
+ reasonCode: failure?.reasonCode ?? 'checkpointPersistenceFailed',
196
197
  durable: false,
198
+ ...(failure?.expected ? { expected: failure.expected } : {}),
199
+ ...(failure?.observed ? { observed: failure.observed } : {}),
200
+ ...(failure?.correlationId ? { correlationId: failure.correlationId } : {}),
197
201
  next: 'reconcileCheckpointState',
198
202
  allowBoundaryFinal: false,
199
203
  };
@@ -13,5 +13,7 @@ export const planSignalReasons = [
13
13
  'resync',
14
14
  ];
15
15
  export function isPlanSignalReason(value) {
16
- return typeof value === 'string' && planSignalReasons.includes(value);
16
+ return (typeof value === 'string' &&
17
+ (planSignalReasons.includes(value) ||
18
+ /^review:[A-Za-z0-9._-]{1,128}:REVIEWED$/.test(value)));
17
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gestalt-mobile",
3
- "version": "0.41.1",
3
+ "version": "0.41.3",
4
4
  "description": "Mobile-first web relay for durable Codex development sessions",
5
5
  "keywords": [
6
6
  "codex",