@awebai/oats 0.69.7 → 0.69.9

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.
@@ -1,15 +1,30 @@
1
- /** The instance-name rule a typed name follows before it reaches `oats spawn --name`: the soul's role is its
2
- * suffix. One copy for the clients (the Desktop's spawn dialog today); the kernel keeps its own for the
3
- * suggestion it will make, and test/client-instance-name.test.mjs pins the cases both must agree on.
1
+ /** The instance-name rules of the clients. A typed name follows one before it reaches `oats spawn --name`: the
2
+ * soul's role is its suffix. One copy for the clients (the Desktop's spawn dialog today); the kernel keeps its own
3
+ * for the suggestion it will make, and test/client-instance-name.test.mjs pins the cases both must agree on.
4
4
  *
5
5
  * A soul's role is the last word of its name: `oats-desktop-expert` → `expert`, `code-reviewer` → `reviewer`,
6
6
  * `cloner` → `cloner`. A package qualifier is dropped first (what follows the last `/` or `--`, as the
7
7
  * identity marks read a name: renderer/identity-marks.mjs markText), so `acme-pkg--keeper` → `keeper`.
8
8
  * A typed name gets the role once: `desktop-improvements` → `desktop-improvements-expert`, while
9
- * `desktop-improvements-expert` and `expert` stay as typed. Nothing here validates a name: the
10
- * kernel owns that grammar and refuses a name that breaks it (E_INSTANCE_NAME_INVALID).
9
+ * `desktop-improvements-expert` and `expert` stay as typed; the kernel refuses a typed name that breaks its
10
+ * grammar (E_INSTANCE_NAME_INVALID).
11
+ *
12
+ * The grammar itself, the kernel's `--name` check (explicitInstanceName: a slug of at most MAX_INSTANCE_NAME
13
+ * characters), is mirrored here for a client that must judge a name with no kernel call (the
14
+ * Desktop's `--instance` launch argument, a spawn's suggested name); the agreement test drives the kernel's own
15
+ * check over the same cases.
11
16
  * DOM-free and import-free, with no module state. */
12
17
 
18
+ /** The kernel's longest instance name (its MAX_INSTANCE_NAME). */
19
+ export const INSTANCE_NAME_MAX = 64;
20
+ const INSTANCE_NAME = new RegExp(`^(?=.{1,${INSTANCE_NAME_MAX}}$)[a-z0-9]+(?:-[a-z0-9]+)*$`);
21
+
22
+ /** Whether `name` is one the kernel's `--name` check takes: lowercase letters and digits, single dashes between
23
+ * them, at most INSTANCE_NAME_MAX characters. */
24
+ export function validInstanceName(name) {
25
+ return typeof name === 'string' && INSTANCE_NAME.test(name);
26
+ }
27
+
13
28
  /** The role of a soul name: its last `-`-separated word after any package qualifier; '' when there is none. */
14
29
  export function soulRole(soulName) {
15
30
  if (typeof soulName !== 'string') return '';
@@ -0,0 +1,25 @@
1
+ // docs/release-notes/v0.40.0.md: oats.framework 1.6.0 carries oats.core 2.4.0,
2
+ // the first Claude needs-input hooks. Compare the home's recorded version, never the lock.
3
+ const NEEDS_INPUT_FRAMEWORK_MIN = Object.freeze([1, 6, 0]);
4
+
5
+ /** The recorded framework version when Claude dialogs cannot be reported as needs input, else null.
6
+ * Both local and remote rows carry drift rows, or a recorded map when the workspace
7
+ * wasn't read. Missing evidence says nothing about reporting coverage. */
8
+ export function needsInputReportingGap(row) {
9
+ if (row?.harness !== 'claude') return null;
10
+ const modules = row.modules;
11
+ const core = Array.isArray(modules) ? modules.find(m => m?.name === 'oats.core')
12
+ : modules && typeof modules === 'object' && Object.hasOwn(modules, 'oats.core') ? modules['oats.core'] : null;
13
+ const from = core?.from;
14
+ if (from?.kind !== 'package' || from.package !== 'oats.framework' || typeof from.version !== 'string') return null;
15
+ // Semver: core numbers and numeric prerelease identifiers have no leading zeros;
16
+ // build identifiers do.
17
+ const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.exec(from.version);
18
+ if (!match || match[4]?.split('.').some(id => /^\d+$/.test(id) && id.length > 1 && id[0] === '0')) return null;
19
+ for (let i = 0; i < NEEDS_INPUT_FRAMEWORK_MIN.length; i++) {
20
+ const number = Number(match[i + 1]), minimum = NEEDS_INPUT_FRAMEWORK_MIN[i];
21
+ if (number !== minimum) return number < minimum ? from.version : null;
22
+ }
23
+ // A prerelease of the first supporting release still sorts below it.
24
+ return match[4] ? from.version : null;
25
+ }
@@ -6,13 +6,14 @@ import { teamRow, defaultTeamOf } from './team-rows.mjs';
6
6
  import { harnessOf, harnessFlag, HARNESSES } from './harness-names.mjs';
7
7
  import { launchOf, PREVIEW_FROM } from './launch-contract.mjs';
8
8
  import { previewWarningsOf } from './capability-warnings-contract.mjs';
9
+ import { INSTANCE_NAME_MAX, validInstanceName } from './instance-name.mjs';
9
10
  export { absolute, record };
10
11
  const exact = (v, keys) => record(v) && Object.keys(v).every(k => keys.includes(k));
11
12
  const name = v => typeof v === 'string' && /^[A-Za-z0-9][A-Za-z0-9._-]{0,255}$/.test(v);
12
13
  /** The kernel caps instance names, explicit and derived, at 64 characters
13
14
  * (#159, E_INSTANCE_NAME_INVALID). A longer --name or --purpose can never
14
15
  * name an instance, so it is refused before any CLI call. */
15
- export const INSTANCE_NAME_MAX = 64;
16
+ export { INSTANCE_NAME_MAX };
16
17
  const INSTANCE_TOKEN = new RegExp(`^[a-z0-9][a-z0-9-]{0,${INSTANCE_NAME_MAX - 1}}$`, 'i');
17
18
  const arg = (v, max = 1024) => typeof v === 'string' && !!v && v.length <= max && !v.startsWith('-') && !/[\x00-\x1f\x7f]/.test(v);
18
19
  const safe = (v, max = 4096) => typeof v === 'string' && v.length <= max && !/[\x00-\x1f\x7f]|https?:\/\/[^/\s]*@|(?:gh[pousr]_|github_pat_)[A-Za-z0-9_]{16,}/.test(v);
@@ -159,15 +160,13 @@ export const instanceSuggestSupported = cli => cli?.ok === true && absolute(cli.
159
160
  export const APPLY_SUGGEST_FEATURE = 'spawn-apply-suggest-name';
160
161
  /** The harnesses a suggest-name call may name (codex answers numbered, `unsupported-harness`, with no call). */
161
162
  export const SUGGEST_HARNESSES = ['claude', 'pi', 'codex'];
162
- /** The exact name a suggestion gives: the kernel's slug, within its cap. */
163
- const SUGGESTED = new RegExp(`^(?=.{1,${INSTANCE_NAME_MAX}}$)[a-z0-9]+(?:-[a-z0-9]+)*$`);
164
163
  /** `oats instance suggest-name`'s answer, `{ name?, naming }`, or null when it is malformed: `naming` as a preview's
165
164
  * (namingOf), and `name` exactly when it was suggested. */
166
165
  export function instanceSuggestion(v) {
167
166
  if (!record(v) || Object.keys(v).some(k => !['name', 'naming'].includes(k))) return null;
168
167
  const naming = namingOf(v.naming);
169
168
  if (!naming) return null;
170
- if (naming.source === 'suggested') return typeof v.name === 'string' && SUGGESTED.test(v.name) ? { name: v.name, naming } : null;
169
+ if (naming.source === 'suggested') return validInstanceName(v.name) ? { name: v.name, naming } : null;
171
170
  return Object.hasOwn(v, 'name') ? null : { naming };
172
171
  }
173
172
  /** The request of the dialog's suggest-name read: `{ action: 'suggest-name', soul, task, harness?, model? }`, or null.