@wayai/cli 0.3.230 → 0.3.231

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/dist/index.js CHANGED
@@ -6231,15 +6231,18 @@ var init_chunk_BEOHBREG = __esm({
6231
6231
  }
6232
6232
  });
6233
6233
 
6234
- // ../../packages/core/dist/chunk-4MRBBR5L.js
6234
+ // ../../packages/core/dist/chunk-OWAAYKPB.js
6235
+ function declaresReview(schema) {
6236
+ return typeof schema === "object" && schema !== null && schema[REVIEW_DECLARATION_KEY] !== void 0;
6237
+ }
6235
6238
  function toolsetFileToolName(entry, op) {
6236
6239
  const names = entry.names;
6237
6240
  const stated = names?.[op];
6238
6241
  return stated !== void 0 && stated !== null ? String(stated) : `${op}_${entry.name ?? entry.file_type}`;
6239
6242
  }
6240
- var TOOLSET_SLUG_SETTING, TOOLSET_SLUG_PATTERN, REKOR_STRUCTURAL_ID_PATTERN, baseEnvironmentSchema, TOOLSET_FILE_OPERATIONS, toolsetFileToolSchema, toolsetSurfaceSchema, toolsetConnectionBindingSchema, rekorToolsetToolsSchema, rekorBoundAttestation, rekorResolvedToolsetSchema, resolvedFileToolSchema, rekorToolsetFileSchema, rekorToolsetFileListSchema, rekorToolsetFileGetSchema, rekorToolsetFilePutSchema, TOOLSET_CUSTOMER_FACING_REFUSAL_MARK, TOOLSET_CUSTOMER_FACING_REFUSAL;
6241
- var init_chunk_4MRBBR5L = __esm({
6242
- "../../packages/core/dist/chunk-4MRBBR5L.js"() {
6243
+ var TOOLSET_SLUG_SETTING, TOOLSET_SLUG_PATTERN, REKOR_STRUCTURAL_ID_PATTERN, baseEnvironmentSchema, TOOLSET_FILE_OPERATIONS, toolsetFileToolSchema, toolsetSurfaceSchema, toolsetConnectionBindingSchema, rekorToolsetToolsSchema, rekorBoundAttestation, rekorResolvedToolsetSchema, REVIEW_DECLARATION_KEY, resolvedRecordTypeSchema, reviewWritersSchema, sharedScopeSchema, resolvedFileToolSchema, rekorToolsetFileSchema, rekorToolsetFileListSchema, rekorToolsetFileGetSchema, rekorToolsetFilePutSchema, TOOLSET_CUSTOMER_FACING_REFUSAL_MARK, TOOLSET_CUSTOMER_FACING_REFUSAL;
6244
+ var init_chunk_OWAAYKPB = __esm({
6245
+ "../../packages/core/dist/chunk-OWAAYKPB.js"() {
6243
6246
  "use strict";
6244
6247
  init_chunk_BEOHBREG();
6245
6248
  init_chunk_DHPUPI4Y();
@@ -6287,6 +6290,22 @@ var init_chunk_4MRBBR5L = __esm({
6287
6290
  * sync or token save records it.
6288
6291
  */
6289
6292
  file_writes: external_exports.boolean().optional(),
6293
+ /**
6294
+ * A record type the toolset's actions or composite steps reach (the resolve's `record_types`) names it
6295
+ * among its writers (`x-review.writers`, #5083 RK4): the toolset writes the type's drafts and reads its
6296
+ * every record, drafts included. Or such a type's declaration this side cannot read, or a resolve
6297
+ * reaching records that carries no record types. A type only its relationship tools reach is not
6298
+ * judged: the resolve does not carry that type's declaration. Absent
6299
+ * on a surface recorded before it was, which the customer-facing rule reads as writing, for a toolset
6300
+ * reaching records, until the connection's next tool sync or token save records it.
6301
+ */
6302
+ review_writes: external_exports.boolean().optional(),
6303
+ /**
6304
+ * Every record type the toolset reaches, at least one, is reviewed (`x-review`), holds no customer data
6305
+ * (`shared`), and does not name it among its writers: each call reads only that type's approved
6306
+ * records (#5083 decision 182, Q9). Absent on a surface recorded before it was, which reads as false.
6307
+ */
6308
+ approved_reads_only: external_exports.boolean().optional(),
6290
6309
  /**
6291
6310
  * The toolset's file tools. Absent when it has none, and on a surface recorded before they were.
6292
6311
  * A list this side cannot read is dropped rather than failing the binding, which every call and
@@ -6369,9 +6388,23 @@ var init_chunk_4MRBBR5L = __esm({
6369
6388
  batch: external_exports.object({ enabled: external_exports.boolean().optional() }).passthrough().nullable().optional(),
6370
6389
  sql_query: external_exports.boolean().optional(),
6371
6390
  /** The toolset serves one customer per call (#5083 RK2). Absent reads as not scoped. */
6372
- customer_scope: external_exports.boolean().optional()
6391
+ customer_scope: external_exports.boolean().optional(),
6392
+ /**
6393
+ * Each record type the toolset's actions and composite steps reach, by id, as the data product
6394
+ * stores it (`json_schema` included). A reviewed type's `x-review` names its writers (#5083 RK4).
6395
+ */
6396
+ record_types: external_exports.record(external_exports.unknown()).optional(),
6397
+ /**
6398
+ * What each record type the toolset can reach is to a customer scope (`{ role }`, or null), by id:
6399
+ * those `record_types` holds, and those only its relationship tools and steps reach (#5083 RK2).
6400
+ */
6401
+ record_type_scopes: external_exports.record(external_exports.unknown()).optional()
6373
6402
  }).passthrough()
6374
6403
  });
6404
+ REVIEW_DECLARATION_KEY = "x-review";
6405
+ resolvedRecordTypeSchema = external_exports.object({ json_schema: external_exports.record(external_exports.unknown()) });
6406
+ reviewWritersSchema = external_exports.object({ writers: external_exports.array(external_exports.string()).optional() });
6407
+ sharedScopeSchema = external_exports.object({ role: external_exports.literal("shared") });
6375
6408
  resolvedFileToolSchema = external_exports.object({
6376
6409
  file_type: external_exports.string().min(1),
6377
6410
  path_prefix: external_exports.string().nullish(),
@@ -6394,7 +6427,7 @@ var init_chunk_4MRBBR5L = __esm({
6394
6427
  });
6395
6428
  rekorToolsetFilePutSchema = external_exports.object({ data: rekorToolsetFileSchema });
6396
6429
  TOOLSET_CUSTOMER_FACING_REFUSAL_MARK = "A customer-facing agent (a pilot, pilot specialist or pilot advisor) can use a toolset only when it exposes files alone: no record, composite or relationship tools, and neither sql_query nor batch";
6397
- TOOLSET_CUSTOMER_FACING_REFUSAL = `${TOOLSET_CUSTOMER_FACING_REFUSAL_MARK}, nor a file put or delete \u2014 unless the toolset is customer-scoped, which admits its record, composite and relationship tools, since each of their calls reaches only the conversation's customer and shared records`;
6430
+ TOOLSET_CUSTOMER_FACING_REFUSAL = `${TOOLSET_CUSTOMER_FACING_REFUSAL_MARK}, nor a file put or delete, nor a write of a reviewed record type \u2014 unless the toolset is customer-scoped, which admits its record, composite and relationship tools, since each of their calls reaches only the conversation's customer and shared records, or they only read approved records of reviewed shared record types`;
6398
6431
  }
6399
6432
  });
6400
6433
 
@@ -6823,7 +6856,7 @@ var init_chunk_A4JC7DXB = __esm({
6823
6856
  }
6824
6857
  });
6825
6858
 
6826
- // ../../packages/core/dist/chunk-23UZ2IKU.js
6859
+ // ../../packages/core/dist/chunk-VMAX5YRT.js
6827
6860
  function spokenLineField(label, description2) {
6828
6861
  return { type: "text", label, maxLength: SPOKEN_LINE_MAX_CHARS, default: "", description: description2 };
6829
6862
  }
@@ -6833,8 +6866,8 @@ function byLowercaseName(a, b) {
6833
6866
  return x < y ? -1 : x > y ? 1 : 0;
6834
6867
  }
6835
6868
  var CALLER_LANGUAGE, TTS_VOICE_REPLY_ENABLED_FIELD, COPILOT_TRIGGER_FIELD, SANDBOX_AGENT_FIELDS, AUDIO_LANGUAGE_OPTIONS, whatsapp, instagram, resend, telegram, API_CHANNEL_DELIVERY_EVENTS, apiChannel, OPENAI_REASONING_MODELS, openai, anthropic, googleAiStudio, openRouter, xai, groqStt, openaiStt, elevenLabsStt, openaiTts, groqTts, elevenLabsTts, GEMINI_TTS_VOICES, googleTts, wayai, externalResources, restApiTool, mcpServer, REKOR_TOOLSET_SERVICE_NAME, rekorToolset, CLAUDE_HARNESS_MODELS, CLAUDE_HARNESS_MODEL_OPTIONS, HARNESS_MCP_SERVERS_FIELD, HARNESS_EGRESS_FIELDS, claudeManagedAgents, SPOKEN_LINE_MAX_CHARS, gptLive, CONNECTORS;
6836
- var init_chunk_23UZ2IKU = __esm({
6837
- "../../packages/core/dist/chunk-23UZ2IKU.js"() {
6869
+ var init_chunk_VMAX5YRT = __esm({
6870
+ "../../packages/core/dist/chunk-VMAX5YRT.js"() {
6838
6871
  "use strict";
6839
6872
  init_chunk_A4JC7DXB();
6840
6873
  CALLER_LANGUAGE = "caller";
@@ -7801,13 +7834,13 @@ var init_chunk_23UZ2IKU = __esm({
7801
7834
  }
7802
7835
  });
7803
7836
 
7804
- // ../../packages/core/dist/chunk-23ESQLLF.js
7837
+ // ../../packages/core/dist/chunk-C4TPQN6Z.js
7805
7838
  var evalCallInstant, EVAL_CALL_MIN_SECONDS, EVAL_CALL_MAX_SECONDS, EVAL_CALL_SPOKEN_LINE_MAX_CHARS, hubScoped2, createEvalCallBody, createEvalCallResponse, evalCallConversationQuery, evalCallRecordQuery, evalCallSpeaker, evalCallUtterance, evalCallTurn, evalCallRecording, evalCallRecordResponse, evalCallFinishResponse;
7806
- var init_chunk_23ESQLLF = __esm({
7807
- "../../packages/core/dist/chunk-23ESQLLF.js"() {
7839
+ var init_chunk_C4TPQN6Z = __esm({
7840
+ "../../packages/core/dist/chunk-C4TPQN6Z.js"() {
7808
7841
  "use strict";
7809
7842
  init_chunk_E4DIIOOE();
7810
- init_chunk_23UZ2IKU();
7843
+ init_chunk_VMAX5YRT();
7811
7844
  init_chunk_HZ6CADSY();
7812
7845
  init_chunk_MIWZOSPI();
7813
7846
  init_zod();
@@ -14976,14 +15009,14 @@ var init_contracts = __esm({
14976
15009
  init_chunk_Y7CFCYX4();
14977
15010
  init_chunk_5DGHIY7L();
14978
15011
  init_chunk_4QBKRQMM();
14979
- init_chunk_4MRBBR5L();
15012
+ init_chunk_OWAAYKPB();
14980
15013
  init_chunk_BEOHBREG();
14981
15014
  init_chunk_IPDOHAZ5();
14982
15015
  init_chunk_YUZFHVB2();
14983
15016
  init_chunk_I3O2RACG();
14984
15017
  init_chunk_34LE6P7E();
14985
15018
  init_chunk_FPSDNS2E();
14986
- init_chunk_23ESQLLF();
15019
+ init_chunk_C4TPQN6Z();
14987
15020
  init_chunk_C4HEZ7ZI();
14988
15021
  init_chunk_IR2NOSI3();
14989
15022
  init_chunk_EA23LSDS();
@@ -15017,7 +15050,7 @@ var init_contracts = __esm({
15017
15050
  init_chunk_4LXDRTO4();
15018
15051
  init_chunk_E4DIIOOE();
15019
15052
  init_chunk_7CYHPF35();
15020
- init_chunk_23UZ2IKU();
15053
+ init_chunk_VMAX5YRT();
15021
15054
  init_chunk_MCSEEMGN();
15022
15055
  init_chunk_UFYIBL66();
15023
15056
  init_chunk_NVKU5PPQ();
@@ -33561,7 +33594,7 @@ token (\`wayai login --token\`, or WAYAI_TOKEN) is refused.
33561
33594
  var init_rekor_toolset = __esm({
33562
33595
  "../../packages/core/dist/contracts/rekor-toolset.js"() {
33563
33596
  "use strict";
33564
- init_chunk_4MRBBR5L();
33597
+ init_chunk_OWAAYKPB();
33565
33598
  init_chunk_BEOHBREG();
33566
33599
  init_chunk_DHPUPI4Y();
33567
33600
  }
@@ -35432,7 +35465,7 @@ var COUNTER_KEYS, STT_PRICING, CONTAINER_PRICING, connectorById, nativeToolById;
35432
35465
  var init_catalog = __esm({
35433
35466
  "../../packages/core/dist/catalog/index.js"() {
35434
35467
  "use strict";
35435
- init_chunk_23UZ2IKU();
35468
+ init_chunk_VMAX5YRT();
35436
35469
  init_chunk_MCSEEMGN();
35437
35470
  init_chunk_UFYIBL66();
35438
35471
  init_chunk_A4JC7DXB();
@@ -39007,8 +39040,10 @@ Stopped at chunk ${nextIndex}. To resume, re-run the SAME command with:
39007
39040
  if (n === 0) {
39008
39041
  console.error("No rows left to undo \u2014 closing the import session.");
39009
39042
  } else {
39043
+ const reviewed = await recordTypeIsReviewed(client, base, plan.record_type);
39044
+ const count = `${reviewed ? "up to " : ""}${n} record${n === 1 ? "" : "s"}`;
39010
39045
  const ok = await confirm(
39011
- `Delete ${n} record${n === 1 ? "" : "s"} created by this import into "${sanitizeTerminalText(String(plan.record_type))}", plus every relationship pointing at them?`
39046
+ `Delete ${count} created by this import into "${sanitizeTerminalText(String(plan.record_type))}"${reviewed ? " (those approved now stay unless you are signed in to WayAI as a person)" : ""}, plus every relationship pointing at them?`
39012
39047
  );
39013
39048
  if (!ok) {
39014
39049
  console.error("Aborted.");
@@ -39018,6 +39053,7 @@ Stopped at chunk ${nextIndex}. To resume, re-run the SAME command with:
39018
39053
  }
39019
39054
  let records = 0;
39020
39055
  let relationships = 0;
39056
+ let kept = 0;
39021
39057
  let calls = 0;
39022
39058
  let incomplete = false;
39023
39059
  for (let sweep = 0; ; sweep++) {
@@ -39029,7 +39065,10 @@ Stopped at chunk ${nextIndex}. To resume, re-run the SAME command with:
39029
39065
  records += res.swept.records;
39030
39066
  relationships += res.swept.relationships;
39031
39067
  calls++;
39032
- if (res.complete) break;
39068
+ if (res.complete) {
39069
+ kept = res.kept?.records ?? 0;
39070
+ break;
39071
+ }
39033
39072
  const sweptNothing = res.swept.records === 0 && res.swept.relationships === 0;
39034
39073
  if (sweptNothing || sweep + 1 >= MAX_ROLLBACK_SWEEPS) {
39035
39074
  incomplete = true;
@@ -39047,10 +39086,16 @@ Stopped at chunk ${nextIndex}. To resume, re-run the SAME command with:
39047
39086
  "Note: a request was re-sent after its outcome was unknown, so the counts below are a lower bound \u2014 a page that committed before its response was lost is not included."
39048
39087
  );
39049
39088
  }
39089
+ if (kept > 0) {
39090
+ console.error(
39091
+ `Kept ${kept} record${kept === 1 ? "" : "s"} of this import that ${kept === 1 ? "is" : "are"} approved: only a person signed in to WayAI removes an approved record. A rollback of this import by one removes them.`
39092
+ );
39093
+ }
39050
39094
  printOutput(
39051
39095
  {
39052
39096
  import_id: importId,
39053
39097
  swept: { records, relationships },
39098
+ ...kept > 0 ? { kept: { records: kept } } : {},
39054
39099
  requests: calls,
39055
39100
  // The server's own completion claim, carried so a script can tell an
39056
39101
  // undo that FINISHED from one that stopped early and needs re-running.
@@ -39063,10 +39108,23 @@ Stopped at chunk ${nextIndex}. To resume, re-run the SAME command with:
39063
39108
  });
39064
39109
  return importCmd;
39065
39110
  }
39111
+ async function recordTypeIsReviewed(client, base, recordType2) {
39112
+ if (recordType2 === null) return false;
39113
+ try {
39114
+ const type = await client.request(
39115
+ "GET",
39116
+ `/v1/${base}/record-types/${pathSegment(recordType2, "record_type")}`
39117
+ );
39118
+ return declaresReview(type?.json_schema);
39119
+ } catch {
39120
+ return true;
39121
+ }
39122
+ }
39066
39123
  var MAX_CHUNK_ROWS, MAX_ATTEMPTS, MAX_ROLLBACK_SWEEPS, BASE_BACKOFF_MS, RETRYABLE_CODES, sleep2;
39067
39124
  var init_import = __esm({
39068
39125
  "src/data/commands/import.ts"() {
39069
39126
  "use strict";
39127
+ init_rekor_toolset();
39070
39128
  init_client();
39071
39129
  init_output();
39072
39130
  init_helpers();