gestalt-mobile 0.41.2 → 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) {
@@ -108,21 +126,32 @@ export function toOrgPlanAttentionAcknowledgement(acknowledgement = { accepted:
108
126
  };
109
127
  }
110
128
  export function isOrgPlanAttentionToolResponse(value) {
129
+ return parseOrgPlanAttentionToolResponse(value) !== null;
130
+ }
131
+ export function parseOrgPlanAttentionToolResponse(value) {
111
132
  if (!isRecord(value) || value.success !== true || !Array.isArray(value.contentItems))
112
- return false;
133
+ return null;
113
134
  const item = value.contentItems[0];
114
135
  if (value.contentItems.length !== 1 ||
115
136
  !isRecord(item) ||
116
137
  item.type !== 'inputText' ||
117
138
  typeof item.text !== 'string')
118
- return false;
139
+ return null;
119
140
  try {
120
- return parseOrgPlanAttentionResponse(JSON.parse(item.text)) !== null;
141
+ return parseOrgPlanAttentionResponse(JSON.parse(item.text));
121
142
  }
122
143
  catch {
123
- return false;
144
+ return null;
124
145
  }
125
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
+ }
126
155
  function isReason(value) {
127
156
  return (typeof value === 'string' && orgPlanAttentionReasons.includes(value));
128
157
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gestalt-mobile",
3
- "version": "0.41.2",
3
+ "version": "0.41.3",
4
4
  "description": "Mobile-first web relay for durable Codex development sessions",
5
5
  "keywords": [
6
6
  "codex",