gestalt-mobile 0.62.1 → 0.62.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.
@@ -11,6 +11,7 @@ import { homedir } from 'node:os';
11
11
  import { checkXerjIndexConfig, saveXerjIndexConfig, xerjContentArguments, xerjIndexConfig, } from './xerj-index-config.js';
12
12
  import { xerjDeadline } from './managed-xerj.js';
13
13
  import { ReadinessEvidence } from './readiness-evidence.js';
14
+ import { saveXerjIndexDiagnostic, xerjIndexDiagnostic } from './xerj-index-diagnostic.js';
14
15
  // Native gitignore syntax, editable by the host operator. Hidden directories and
15
16
  // symlinks are already skipped by XERJ. Never replace an existing root policy.
16
17
  export const xerjDefaultIgnores = `# Gestalt source discovery. Edit these native XERJ rules to change scope.
@@ -65,6 +66,9 @@ export class XerjIndexer {
65
66
  closed = false;
66
67
  saveConfiguration;
67
68
  configurationSaved;
69
+ diagnosticDirectory;
70
+ pendingDiagnostic;
71
+ diagnosticSaved;
68
72
  constructor(root, mode, capability, environment = process.env, report = console.warn) {
69
73
  this.capability = capability;
70
74
  this.environment = environment;
@@ -119,6 +123,7 @@ export class XerjIndexer {
119
123
  }
120
124
  const directory = join(this.environment.CODEX_HOME ?? join(homedir(), '.codex-gestalt'), 'xerj-data', 'autoindex', namespace);
121
125
  const config = xerjIndexConfig(root, namespace, ready.endpoint);
126
+ this.diagnosticDirectory = directory;
122
127
  const compatibility = await checkXerjIndexConfig(directory, config);
123
128
  if (this.closed)
124
129
  return;
@@ -239,22 +244,47 @@ export class XerjIndexer {
239
244
  });
240
245
  }
241
246
  else if (event.event === 'warning') {
242
- if (typeof event.message === 'string' &&
243
- event.message.includes('refusing ambiguous assignment')) {
244
- this.fail('XERJ incremental dataset assignment failed; the index is stale. See the XERJ recovery guide for this upstream limitation.');
247
+ const diagnostic = xerjIndexDiagnostic(event.message);
248
+ this.value = { ...this.value, diagnostic };
249
+ this.pendingDiagnostic = diagnostic;
250
+ this.diagnosticSaved ??= this.saveDiagnostics();
251
+ const reference = ` Diagnostic: ${diagnostic.id} (${diagnostic.code}).`;
252
+ if (diagnostic.code === 'ambiguous-assignment') {
253
+ this.fail('XERJ incremental dataset assignment failed; the index is stale. See the XERJ recovery guide for this upstream limitation.' +
254
+ reference);
245
255
  return;
246
256
  }
247
- this.fail('XERJ reported an indexing warning. Inspect the index with gestalt xerj autoindex status; source changes trigger another pass.');
257
+ this.fail('XERJ reported an indexing warning. Inspect the index with gestalt xerj autoindex status; source changes trigger another pass.' +
258
+ reference);
248
259
  }
249
260
  }
250
261
  catch {
251
262
  /* Native diagnostics are not public status or application logs. */
252
263
  }
253
264
  }
265
+ async saveDiagnostics() {
266
+ try {
267
+ // Coalesce bursts to the latest warning instead of queuing unbounded writes.
268
+ while (this.pendingDiagnostic && this.diagnosticDirectory) {
269
+ const diagnostic = this.pendingDiagnostic;
270
+ this.pendingDiagnostic = undefined;
271
+ try {
272
+ await saveXerjIndexDiagnostic(this.diagnosticDirectory, diagnostic);
273
+ }
274
+ catch {
275
+ this.report('XERJ could not save its redacted indexing diagnostic.');
276
+ }
277
+ }
278
+ }
279
+ finally {
280
+ this.diagnosticSaved = undefined;
281
+ }
282
+ }
254
283
  async close() {
255
284
  this.closed = true;
256
285
  await this.task;
257
286
  await this.configurationSaved;
287
+ await this.diagnosticSaved;
258
288
  const child = this.child;
259
289
  if (child && child.exitCode === null && child.signalCode === null) {
260
290
  await new Promise((resolve) => {
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright (C) 2026 Dyne.org foundation
3
+ * Designed by Denis Roio <jaromil@dyne.org>
4
+ * SPDX-License-Identifier: AGPL-3.0-or-later
5
+ */
6
+ export const gestaltOrgPlanTakeoverDynamicTool = {
7
+ type: 'function',
8
+ name: 'gestalt_org_plan_takeover',
9
+ description: 'Take over the current unfinished Org Plan in this new supervisor session when the user explicitly instructed you to take over or continue it here. That instruction supplies authorization; do not ask for another approval or declare a permission blocker. Mobile fences previous supervisors, confirms their writers stopped, preserves checkpoint history, and returns the exact replacement executor identity for this root. Retries return the same pending identity, never a new generation: if that task name already exists in this root, resume it instead of spawning it again. Do not follow up or interrupt an executor belonging to another root. Does not waive review, model-policy, or pending-interaction gates. On failure, report the returned specific recovery code; never launch a competing writer.',
10
+ inputSchema: {
11
+ type: 'object',
12
+ additionalProperties: false,
13
+ required: ['version', 'reason'],
14
+ properties: {
15
+ version: { const: 1 },
16
+ reason: { const: 'userDirectedTakeover' },
17
+ },
18
+ },
19
+ };
20
+ export function isOrgPlanTakeoverCall(input) {
21
+ if (input.method !== 'item/tool/call' || !record(input.params))
22
+ return false;
23
+ const args = input.params.arguments;
24
+ return (input.params.tool === gestaltOrgPlanTakeoverDynamicTool.name &&
25
+ record(args) &&
26
+ Object.keys(args).length === 2 &&
27
+ args.version === 1 &&
28
+ args.reason === 'userDirectedTakeover');
29
+ }
30
+ function record(value) {
31
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
32
+ }
@@ -8,6 +8,7 @@
8
8
  "checkpoint-tool",
9
9
  "l2-report-boundary",
10
10
  "agent-capacity-recovery",
11
+ "user-directed-supervisor-takeover",
11
12
  "controller-status",
12
13
  "canonical-agent-identity",
13
14
  "session-verdict",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gestalt-mobile",
3
- "version": "0.62.1",
3
+ "version": "0.62.3",
4
4
  "description": "Mobile-first web relay for durable Codex development sessions",
5
5
  "keywords": [
6
6
  "codex",