executor 1.1.5 → 1.1.7

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.
package/bin/executor.mjs CHANGED
@@ -169375,41 +169375,6 @@ var make81 = (identifier2, options9) => makeProto4({
169375
169375
  // packages/codemode-openapi/src/openapi-tools.ts
169376
169376
  class OpenApiToolInvocationError extends TaggedError("OpenApiToolInvocationError") {
169377
169377
  }
169378
- var BLOCKED_RESPONSE_HEADER_NAMES = new Set([
169379
- "authorization",
169380
- "authentication-info",
169381
- "cookie",
169382
- "proxy-authenticate",
169383
- "proxy-authorization",
169384
- "set-cookie",
169385
- "set-cookie2",
169386
- "www-authenticate",
169387
- "x-api-key",
169388
- "x-auth-token",
169389
- "x-csrf-token"
169390
- ]);
169391
- var NOISY_RESPONSE_HEADER_NAMES = new Set([
169392
- "alt-svc",
169393
- "cf-ray",
169394
- "server",
169395
- "traceparent",
169396
- "tracestate",
169397
- "via",
169398
- "x-cache",
169399
- "x-cache-hits",
169400
- "x-powered-by",
169401
- "x-request-id",
169402
- "x-runtime",
169403
- "x-served-by",
169404
- "x-trace-id"
169405
- ]);
169406
- var NOISY_RESPONSE_HEADER_PREFIXES = [
169407
- "cf-",
169408
- "trace-",
169409
- "x-amz-cf-",
169410
- "x-b3-",
169411
- "x-cloud-trace-"
169412
- ];
169413
169378
  var isRecord3 = (value6) => typeof value6 === "object" && value6 !== null && !Array.isArray(value6);
169414
169379
  var asToolArgs = (value6) => {
169415
169380
  if (!isRecord3(value6)) {
@@ -169518,18 +169483,6 @@ var normalizeHttpUrl = (value6) => {
169518
169483
  });
169519
169484
  }
169520
169485
  };
169521
- var shouldDropResponseHeader = (headerName) => BLOCKED_RESPONSE_HEADER_NAMES.has(headerName) || NOISY_RESPONSE_HEADER_NAMES.has(headerName) || NOISY_RESPONSE_HEADER_PREFIXES.some((prefix) => headerName.startsWith(prefix));
169522
- var sanitizeResponseHeaders = (headers) => {
169523
- const sanitized = {};
169524
- for (const [rawName, rawValue] of Object.entries(headers)) {
169525
- const name3 = rawName.trim().toLowerCase();
169526
- if (name3.length === 0 || shouldDropResponseHeader(name3)) {
169527
- continue;
169528
- }
169529
- sanitized[name3] = rawValue.length > 4000 ? `${rawValue.slice(0, 4000)}...` : rawValue;
169530
- }
169531
- return sanitized;
169532
- };
169533
169486
  var decodeHttpClientResponseBody = (response) => {
169534
169487
  const contentType = response.headers["content-type"]?.toLowerCase() ?? "";
169535
169488
  if (contentType.includes("application/json")) {
@@ -169537,6 +169490,24 @@ var decodeHttpClientResponseBody = (response) => {
169537
169490
  }
169538
169491
  return response.text.pipe(mapError2((cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2))));
169539
169492
  };
169493
+ var summarizeHttpResponseBody = (body2) => {
169494
+ if (body2 === null || body2 === undefined) {
169495
+ return null;
169496
+ }
169497
+ if (typeof body2 === "string") {
169498
+ const trimmed2 = body2.trim();
169499
+ if (trimmed2.length === 0) {
169500
+ return null;
169501
+ }
169502
+ return trimmed2.length > 500 ? `${trimmed2.slice(0, 500)}...` : trimmed2;
169503
+ }
169504
+ try {
169505
+ const serialized = JSON.stringify(body2);
169506
+ return serialized.length > 500 ? `${serialized.slice(0, 500)}...` : serialized;
169507
+ } catch {
169508
+ return String(body2);
169509
+ }
169510
+ };
169540
169511
  var inputSchemaFromTypingJson = (inputSchemaJson) => {
169541
169512
  if (!inputSchemaJson) {
169542
169513
  return unknownInputSchema;
@@ -169665,12 +169636,14 @@ var createOpenApiToolsFromManifest = (input) => {
169665
169636
  }
169666
169637
  const response = yield* client.execute(clientRequest).pipe(mapError2((cause2) => cause2 instanceof Error ? cause2 : new Error(String(cause2))));
169667
169638
  const body2 = yield* decodeHttpClientResponseBody(response);
169668
- return {
169669
- ok: response.status >= 200 && response.status < 300,
169670
- status: response.status,
169671
- headers: sanitizeResponseHeaders(response.headers),
169672
- body: body2
169673
- };
169639
+ if (response.status < 200 || response.status >= 300) {
169640
+ throw new OpenApiToolInvocationError({
169641
+ operation: "http_response",
169642
+ message: `OpenAPI request failed with HTTP ${response.status}`,
169643
+ details: summarizeHttpResponseBody(body2)
169644
+ });
169645
+ }
169646
+ return body2;
169674
169647
  }).pipe(provide2(httpClientLayer)));
169675
169648
  }
169676
169649
  },
@@ -203201,7 +203174,7 @@ var createExecutorToolMap = (input) => ({
203201
203174
  // packages/control-plane/src/runtime/graphql-tools.ts
203202
203175
  import { createHash } from "node:crypto";
203203
203176
  var import_graphql = __toESM(require_graphql2(), 1);
203204
- var BLOCKED_RESPONSE_HEADER_NAMES2 = new Set([
203177
+ var BLOCKED_RESPONSE_HEADER_NAMES = new Set([
203205
203178
  "authorization",
203206
203179
  "authentication-info",
203207
203180
  "cookie",
@@ -203260,11 +203233,11 @@ var asStringRecord = (value6) => {
203260
203233
  }
203261
203234
  return normalized;
203262
203235
  };
203263
- var sanitizeResponseHeaders2 = (headers) => {
203236
+ var sanitizeResponseHeaders = (headers) => {
203264
203237
  const sanitized = {};
203265
203238
  for (const [rawName, rawValue] of Object.entries(headers)) {
203266
203239
  const name3 = rawName.trim().toLowerCase();
203267
- if (name3.length === 0 || BLOCKED_RESPONSE_HEADER_NAMES2.has(name3)) {
203240
+ if (name3.length === 0 || BLOCKED_RESPONSE_HEADER_NAMES.has(name3)) {
203268
203241
  continue;
203269
203242
  }
203270
203243
  sanitized[name3] = rawValue;
@@ -203927,7 +203900,7 @@ var invokeGraphqlHttpRequest = (input) => gen2(function* () {
203927
203900
  });
203928
203901
  return {
203929
203902
  status: response.status,
203930
- headers: sanitizeResponseHeaders2(responseHeaders),
203903
+ headers: sanitizeResponseHeaders(responseHeaders),
203931
203904
  body: body2,
203932
203905
  isError: response.status >= 400 || hasGraphqlErrors(body2)
203933
203906
  };
@@ -227575,13 +227548,16 @@ var tryDetectOpenApi = (input) => gen2(function* () {
227575
227548
  headers: input.headers
227576
227549
  }));
227577
227550
  if (response._tag === "Left") {
227551
+ console.warn(`[discovery] OpenAPI probe HTTP fetch failed for ${input.normalizedUrl}:`, response.left.message);
227578
227552
  return null;
227579
227553
  }
227580
227554
  if (response.right.status < 200 || response.right.status >= 300) {
227555
+ console.warn(`[discovery] OpenAPI probe got status ${response.right.status} for ${input.normalizedUrl}`);
227581
227556
  return null;
227582
227557
  }
227583
227558
  const manifest = yield* either3(extractOpenApiManifest(input.normalizedUrl, response.right.text));
227584
227559
  if (manifest._tag === "Left") {
227560
+ console.warn(`[discovery] OpenAPI manifest extraction failed for ${input.normalizedUrl}:`, manifest.left instanceof Error ? manifest.left.message : String(manifest.left));
227585
227561
  return null;
227586
227562
  }
227587
227563
  const document2 = yield* either3(try_3({
@@ -227608,7 +227584,10 @@ var tryDetectOpenApi = (input) => gen2(function* () {
227608
227584
  warnings: []
227609
227585
  }
227610
227586
  };
227611
- }).pipe(catchAll2(() => succeed8(null)));
227587
+ }).pipe(catchAll2((error51) => {
227588
+ console.warn(`[discovery] OpenAPI detection unexpected error for ${input.normalizedUrl}:`, error51 instanceof Error ? error51.message : String(error51));
227589
+ return succeed8(null);
227590
+ }));
227612
227591
  var looksLikeGraphqlEndpoint = (normalizedUrl) => /graphql/i.test(new URL(normalizedUrl).pathname);
227613
227592
  var tryParseJson = (value6) => {
227614
227593
  try {
@@ -230447,6 +230426,18 @@ var parseJsonValue = (value6) => {
230447
230426
  return value6;
230448
230427
  }
230449
230428
  };
230429
+ var maxResultPreviewChars = 30000;
230430
+ var truncateText = (value6, maxLength2) => value6.length > maxLength2 ? `${value6.slice(0, maxLength2)}
230431
+ ... [result preview truncated ${value6.length - maxLength2} chars]` : value6;
230432
+ var formatResultPreview = (resultJson) => {
230433
+ try {
230434
+ const parsed = JSON.parse(resultJson);
230435
+ const serialized = typeof parsed === "string" ? parsed : JSON.stringify(parsed, null, 2) ?? String(parsed);
230436
+ return truncateText(serialized, maxResultPreviewChars);
230437
+ } catch {
230438
+ return truncateText(resultJson, maxResultPreviewChars);
230439
+ }
230440
+ };
230450
230441
  var parseInteractionPayload = (interaction) => {
230451
230442
  try {
230452
230443
  const parsed = JSON.parse(interaction.payloadJson);
@@ -230515,8 +230506,14 @@ var loadExecuteDescription = (runtime6) => runControlPlane(runtime6, gen2(functi
230515
230506
  }).pipe(catchAll2(() => succeed8(defaultExecuteDescription))));
230516
230507
  var summarizeExecution = (execution2) => {
230517
230508
  switch (execution2.status) {
230518
- case "completed":
230519
- return `Execution ${execution2.id} completed.`;
230509
+ case "completed": {
230510
+ if (execution2.resultJson === null) {
230511
+ return `Execution ${execution2.id} completed.`;
230512
+ }
230513
+ return `Execution ${execution2.id} completed.
230514
+ Result:
230515
+ ${formatResultPreview(execution2.resultJson)}`;
230516
+ }
230520
230517
  case "failed":
230521
230518
  return execution2.errorText ? `Execution ${execution2.id} failed: ${execution2.errorText}` : `Execution ${execution2.id} failed.`;
230522
230519
  case "waiting_for_interaction":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "executor",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "Local AI executor with a CLI, local API server, and web UI.",
5
5
  "keywords": [
6
6
  "executor",
@@ -1 +1 @@
1
- import{r,R as c,M as p,B as x}from"./mermaid-O7DHMXV3-Dxron3oj.js";import{j as d}from"./index-CRuElBS1.js";var R=({code:i,language:e,raw:t,className:g,startLine:u,...m})=>{let{shikiTheme:o}=r.useContext(c),a=p(),[n,s]=r.useState(t);return r.useEffect(()=>{if(!a){s(t);return}let l=a.highlight({code:i,language:e,themes:o},h=>{s(h)});l&&s(l)},[i,e,o,a,t]),d.jsx(x,{className:g,language:e,result:n,startLine:u,...m})};export{R as HighlightedCodeBlockBody};
1
+ import{r,R as c,M as p,B as x}from"./mermaid-O7DHMXV3-vieFHMDb.js";import{j as d}from"./index-CRuElBS1.js";var R=({code:i,language:e,raw:t,className:g,startLine:u,...m})=>{let{shikiTheme:o}=r.useContext(c),a=p(),[n,s]=r.useState(t);return r.useEffect(()=>{if(!a){s(t);return}let l=a.highlight({code:i,language:e,themes:o},h=>{s(h)});l&&s(l)},[i,e,o,a,t]),d.jsx(x,{className:g,language:e,result:n,startLine:u,...m})};export{R as HighlightedCodeBlockBody};