@hearsay-tools/squawk 0.18.0-pr4304.8351 → 0.18.0-pr4307.8368

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.
@@ -13,6 +13,7 @@ import { fileURLToPath } from 'node:url';
13
13
  */
14
14
  /** The entry files of a bundled runner folder, in lookup order: built `dist/` has `index.js`, the source checkout `index.ts`. */
15
15
  export const BUNDLED_RUNNER_ENTRY_FILES = ['index.mjs', 'index.js', 'index.ts'];
16
+ // oxlint-disable-next-line cez/regex-module-syntax -- reads the one-line declaration the entry contract above fixes, fails closed, and production code has no parser
16
17
  const DISPLAY_ORDER = /^export const displayOrder = (\d+);$/gm;
17
18
  /** The `runners/` folder next to this module's folder, in the source checkout and in `dist/`. */
18
19
  export function bundledRunnersDir() {
@@ -1 +1 @@
1
- {"version":3,"file":"bundled-runners.js","sourceRoot":"","sources":["../../src/plugin/bundled-runners.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;;;;;;GASG;AAEH,iIAAiI;AACjI,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,CAAU,CAAC;AAUzF,MAAM,aAAa,GAAG,wCAAwC,CAAC;AAE/D,iGAAiG;AACjG,MAAM,UAAU,iBAAiB;IAC/B,OAAO,aAAa,CAAC,IAAI,GAAG,CAAC,aAAa,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,MAAM,CAAC,IAAY;IAC1B,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KA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GAAG,CAAC,CAAC;IAC3N,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,gBAAgB,CAAC,GAAY;IAC3C,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC5D,CAAC"}
@@ -12273,20 +12273,20 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
12273
12273
  } & {
12274
12274
  "/runs/:id/handoff": {
12275
12275
  $get: {
12276
- output: {
12277
- error: string;
12278
- };
12279
- outputFormat: "json";
12280
- status: 404;
12276
+ output: string;
12277
+ outputFormat: "text";
12278
+ status: 200;
12281
12279
  input: {
12282
12280
  param: {
12283
12281
  id: string;
12284
12282
  };
12285
12283
  };
12286
12284
  } | {
12287
- output: string;
12288
- outputFormat: "text";
12289
- status: 200;
12285
+ output: {
12286
+ error: string;
12287
+ };
12288
+ outputFormat: "json";
12289
+ status: 404;
12290
12290
  input: {
12291
12291
  param: {
12292
12292
  id: string;
@@ -12324,20 +12324,20 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
12324
12324
  } & {
12325
12325
  "/runs/:id/diff": {
12326
12326
  $get: {
12327
- output: {
12328
- error: string;
12329
- };
12330
- outputFormat: "json";
12331
- status: 404 | 409;
12327
+ output: string;
12328
+ outputFormat: "text";
12329
+ status: import("hono/utils/http-status").ContentfulStatusCode;
12332
12330
  input: {
12333
12331
  param: {
12334
12332
  id: string;
12335
12333
  };
12336
12334
  };
12337
12335
  } | {
12338
- output: string;
12339
- outputFormat: "text";
12340
- status: import("hono/utils/http-status").ContentfulStatusCode;
12336
+ output: {
12337
+ error: string;
12338
+ };
12339
+ outputFormat: "json";
12340
+ status: 404 | 409;
12341
12341
  input: {
12342
12342
  param: {
12343
12343
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hearsay-tools/squawk",
3
- "version": "0.18.0-pr4304.8351",
3
+ "version": "0.18.0-pr4307.8368",
4
4
  "description": "Local cockpit for running and tracking AI agent tasks in your repo. Uses your logged-in `claude` CLI and `gh` — zero config, zero database.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -68,8 +68,8 @@
68
68
  "devDependencies": {
69
69
  "@babel/parser": "^8.0.8",
70
70
  "@babel/types": "^8.0.8",
71
- "@open-mercato/cezar-api-client": "0.18.0-pr4304.8351",
72
- "@open-mercato/cezar-contract": "0.18.0-pr4304.8351",
71
+ "@open-mercato/cezar-api-client": "0.18.0-pr4307.8368",
72
+ "@open-mercato/cezar-contract": "0.18.0-pr4307.8368",
73
73
  "@types/node": "^24.19.1",
74
74
  "@types/ws": "^8.18.1",
75
75
  "esbuild": "^0.28.1",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "bae52397ce0c91fa4883a01b48cd8985aa23b98a"
89
+ "gitHead": "e3dcffce63235c397eb9cc4f2a075b89d936ba2e"
90
90
  }
@@ -13,6 +13,8 @@ import { createRequire } from 'node:module';
13
13
  import { existsSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
14
14
  import { basename, dirname, join, relative, resolve } from 'node:path';
15
15
  import { fileURLToPath } from 'node:url';
16
+ import { parse } from '@babel/parser';
17
+ import { traverse } from '@babel/types';
16
18
  import { build } from 'esbuild';
17
19
 
18
20
  const here = dirname(fileURLToPath(import.meta.url));
@@ -44,7 +46,17 @@ scan(dist);
44
46
  // specifiers (`from`, `import(...)`, side-effect `import`) to the sibling `dist/plugin/<stem>.js`
45
47
  // declaration without touching string-literal type constants; `.js` runtime imports stay on the
46
48
  // package specifier and resolve through `installPluginResolveHook()`.
47
- const PLUGIN_SPEC = /(from\s+|import\s*\(\s*|import\s+)(['"])@hearsay-tools\/squawk\/plugin(?:\/(runtime|model-settings|managed-cli|pi-rpc))?\2/g;
49
+ const PLUGIN_PACKAGE = '@hearsay-tools/squawk/plugin';
50
+ const PLUGIN_SPEC = /^@hearsay-tools\/squawk\/plugin(?:\/(runtime|model-settings|managed-cli|pi-rpc))?$/;
51
+ /** The module specifier literals of a declaration file: `from`, side-effect `import` and `import(...)` types. */
52
+ function declarationSpecifiers(text) {
53
+ const found = [];
54
+ traverse(parse(text, { sourceType: 'module', plugins: [['typescript', { dts: true }]] }), (node) => {
55
+ if ((node.type === 'ImportDeclaration' || node.type === 'ExportNamedDeclaration' || node.type === 'ExportAllDeclaration'
56
+ || node.type === 'TSImportType' || node.type === 'ImportExpression') && node.source?.type === 'StringLiteral') found.push(node.source);
57
+ });
58
+ return found;
59
+ }
48
60
  const pluginDir = join(dist, 'plugin');
49
61
  function repointPluginDecls() {
50
62
  if (!existsSync(join(pluginDir, 'index.d.ts'))) return 0;
@@ -56,13 +68,19 @@ function repointPluginDecls() {
56
68
  if (p !== outdir) walk(p);
57
69
  } else if (item.name.endsWith('.d.ts')) {
58
70
  const text = readFileSync(p, 'utf8');
59
- PLUGIN_SPEC.lastIndex = 0;
60
- if (!PLUGIN_SPEC.test(text)) continue;
61
- const next = text.replace(PLUGIN_SPEC, (_match, prefix, _quote, sub) => {
71
+ if (!text.includes(PLUGIN_PACKAGE)) continue;
72
+ const targets = declarationSpecifiers(text).flatMap((literal) => {
73
+ const match = PLUGIN_SPEC.exec(literal.value);
74
+ return match ? [{ literal, sub: match[1] }] : [];
75
+ });
76
+ if (targets.length === 0) continue;
77
+ let next = text;
78
+ // Replace from the end, so the offsets of earlier literals stay valid.
79
+ for (const { literal, sub } of targets.reverse()) {
62
80
  let rel = relative(dirname(p), join(pluginDir, `${sub ?? 'index'}.js`)).replaceAll('\\', '/');
63
81
  if (!rel.startsWith('.')) rel = `./${rel}`;
64
- return `${prefix}'${rel}'`;
65
- });
82
+ next = `${next.slice(0, literal.start)}'${rel}'${next.slice(literal.end)}`;
83
+ }
66
84
  writeFileSync(p, next, 'utf8');
67
85
  count++;
68
86
  }
@@ -97,8 +115,12 @@ const bundled = await build({
97
115
  // root bundle's unrelated exports (hearsay-tools/cezarion#1813).
98
116
  const rootExports = new Set(Object.values(bundled.metafile.outputs).flatMap((output) => output.exports));
99
117
  for (const file of referrers.filter((name) => name.endsWith('.js'))) {
100
- for (const match of readFileSync(file, 'utf8').matchAll(/export\s+\*\s+from\s+['"](@open-mercato\/cezar-contract\/([^'"]+))['"]/g)) {
101
- const source = join(contractRoot, 'src', `${match[2]}.ts`);
118
+ const wildcards = [];
119
+ traverse(parse(readFileSync(file, 'utf8'), { sourceType: 'module' }), (node) => {
120
+ if (node.type === 'ExportAllDeclaration' && node.source.value.startsWith('@open-mercato/cezar-contract/')) wildcards.push(node.source.value);
121
+ });
122
+ for (const specifier of wildcards) {
123
+ const source = join(contractRoot, 'src', `${specifier.slice('@open-mercato/cezar-contract/'.length)}.ts`);
102
124
  const original = await build({
103
125
  entryPoints: [source], bundle: true, write: false, metafile: true,
104
126
  format: 'esm', platform: 'neutral', external: ['zod'],
@@ -106,7 +128,7 @@ for (const file of referrers.filter((name) => name.endsWith('.js'))) {
106
128
  const missing = Object.values(original.metafile.outputs).flatMap((output) => output.exports)
107
129
  .filter((name) => !rootExports.has(name));
108
130
  if (missing.length) {
109
- console.error(`inline-contract: ${relative(dist, file)} wildcard re-export of "${match[1]}" loses root exports: ${missing.join(', ')}`);
131
+ console.error(`inline-contract: ${relative(dist, file)} wildcard re-export of "${specifier}" loses root exports: ${missing.join(', ')}`);
110
132
  process.exit(1);
111
133
  }
112
134
  }
@@ -147,6 +169,7 @@ const gaps = importers.length === 0 ? [] : await build({
147
169
  if (gaps.length > 0) {
148
170
  for (const { text, location } of gaps) {
149
171
  const where = location ? `${join(basename(dist), location.file)}:${location.line}` : basename(dist);
172
+ // oxlint-disable-next-line cez/regex-module-syntax -- reads esbuild's error message text, not module source.
150
173
  const name = /import "([^"]+)"/i.exec(text)?.[1];
151
174
  const subpath = /"contract:([^"]+)"/.exec(text)?.[1];
152
175
  console.error(name && subpath