@answerlayer/cli 0.2.7 → 0.3.1

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/README.md CHANGED
@@ -83,6 +83,86 @@ export ANSWERLAYER_BASE_URL=https://answerlayer.your-company.com # optional ove
83
83
 
84
84
  The CLI sends API keys using the `X-API-Key` header.
85
85
 
86
+ ## Configure inquiry response policies
87
+
88
+ Response policies control answer presentation and uncertainty handling without
89
+ changing data access, semantic definitions, or citation integrity. Policies are
90
+ versioned: creating or revising a policy produces a draft, and inquiries use an
91
+ immutable revision once it is selected. API keys need `inquiry_policy:read` to
92
+ inspect policies and `inquiry_policy:write` to manage them.
93
+
94
+ Create and preview a policy before activating its first revision:
95
+
96
+ ```bash
97
+ answerlayer inquiry-policies preview \
98
+ --output-format table_first \
99
+ --precision-mode significant_figures --precision-value 4 \
100
+ --require-identifiers --require-numeric-support \
101
+ --insufficient-data ask_for_clarification \
102
+ --proxy-behavior require_confirmation \
103
+ --guidance "Lead with the decision-relevant result." --json
104
+
105
+ answerlayer inquiry-policies create \
106
+ --name "Board answers" \
107
+ --description "Concise, board-ready answers" \
108
+ --output-format table_first \
109
+ --precision-mode significant_figures --precision-value 4 \
110
+ --require-identifiers --require-numeric-support \
111
+ --insufficient-data ask_for_clarification \
112
+ --proxy-behavior require_confirmation \
113
+ --guidance "Lead with the decision-relevant result." --json
114
+
115
+ answerlayer inquiry-policies activate "Board answers" 1 --json
116
+ ```
117
+
118
+ Policy options accept these values:
119
+
120
+ - `--output-format`: `concise`, `narrative`, or `table_first`.
121
+ - `--precision-mode`: `preserve_source`, `minimum_decimal_places` (value
122
+ `0-10`), or `significant_figures` (value `1-15`). `preserve_source` does not
123
+ accept `--precision-value`.
124
+ - Evidence switches: `--require-identifiers` / `--no-require-identifiers` and
125
+ `--require-numeric-support` / `--no-require-numeric-support`.
126
+ - `--insufficient-data`: `explain_and_stop`, `ask_for_clarification`, or
127
+ `conditional_proxy`.
128
+ - `--proxy-behavior`: `forbid_unconfirmed`, `require_confirmation`, or
129
+ `allow_with_prominent_qualification`.
130
+ - `--guidance`: optional administrator instructions for tone, structure,
131
+ terminology, and caveats. Platform safety and data-authority rules retain
132
+ higher precedence.
133
+
134
+ Create a new immutable draft revision, then activate it explicitly:
135
+
136
+ ```bash
137
+ answerlayer inquiry-policies revise "Board answers" \
138
+ --output-format concise \
139
+ --precision-mode preserve_source \
140
+ --guidance "State the result before supporting detail." --json
141
+ answerlayer inquiry-policies activate "Board answers" 2 --json
142
+ ```
143
+
144
+ Set the active policy as the organization default or override it for one
145
+ connection. Resolution precedence is explicit policy, connection default,
146
+ organization default, then the built-in platform policy:
147
+
148
+ ```bash
149
+ answerlayer inquiry-policies set-default organization "Board answers" --json
150
+ answerlayer inquiry-policies set-default connection <connection-id> "Board answers" --json
151
+ answerlayer inquiry-policies effective --connection <connection-id> --json
152
+ answerlayer inquiry-policies clear-default connection <connection-id>
153
+ ```
154
+
155
+ Omit `--policy` to use those defaults, or pin a policy and exact revision for a
156
+ new inquiry or evaluation run. Existing sessions and runs remain pinned even if
157
+ a different revision is activated later:
158
+
159
+ ```bash
160
+ answerlayer inquiry create-session --connection <connection-id> \
161
+ --policy "Board answers" --policy-version 2 --json
162
+ answerlayer evals runs create --suite <suite-id> \
163
+ --policy "Board answers" --policy-version 2 --json
164
+ ```
165
+
86
166
  ## Operate API pipelines
87
167
 
88
168
  API pipeline authoring and lifecycle operations are CLI-first. The AnswerLayer
@@ -144,12 +224,44 @@ Run and operate the promoted revision:
144
224
 
145
225
  ```bash
146
226
  answerlayer pipelines runs start <pipeline-id> --wait --json
227
+ answerlayer pipelines runs start <pipeline-id> \
228
+ --dataset agep --dataset agepxbplp \
229
+ --idempotency-key census-2021-backfill --wait --json
147
230
  answerlayer pipelines runs get <pipeline-id> <run-id> --json
148
- answerlayer pipelines runs retry <pipeline-id> <run-id> --wait --json
231
+ answerlayer pipelines runs retry <pipeline-id> <run-id> \
232
+ --idempotency-key census-2021-retry-1 --wait --json
149
233
  answerlayer pipelines runs cancel <pipeline-id> <run-id> --json
150
234
  answerlayer pipelines archive <pipeline-id> --json
151
235
  ```
152
236
 
237
+ Dataset scope is explicit and fail-closed: every requested dataset must be in
238
+ the promoted package's resolved catalog. Retrying a publish run reuses the
239
+ previous run's durable dataset checkpoint, so completed datasets are not
240
+ republished. Reusing an idempotency key returns the original matching run
241
+ instead of launching a duplicate.
242
+
243
+ Create and operate the pipeline's install-local EventBridge schedule:
244
+
245
+ ```bash
246
+ answerlayer pipelines schedule set <pipeline-id> \
247
+ --expression 'cron(0 2 * * ? *)' --json
248
+ answerlayer pipelines schedule get <pipeline-id> --json
249
+ answerlayer pipelines schedule resume <pipeline-id> --json
250
+ answerlayer pipelines schedule update <pipeline-id> \
251
+ --expression 'rate(12 hours)' --json
252
+ answerlayer pipelines schedule pause <pipeline-id> --json
253
+ answerlayer pipelines schedule delete <pipeline-id>
254
+ ```
255
+
256
+ Creating a schedule only defines it; new schedules are unarmed by default.
257
+ Run `schedule resume` after review, or pass `--armed` to `schedule set` when
258
+ immediate activation is intentional. `--paused` remains an explicit spelling
259
+ for creating the schedule unarmed.
260
+
261
+ Scheduled tasks invoke the isolated extractor directly and continue when the
262
+ AnswerLayer web process is unavailable. Disabling or archiving a pipeline also
263
+ stops its schedule from launching new work.
264
+
153
265
  Roll back by selecting a revision that was previously promoted. This moves the
154
266
  active pointer back to the existing immutable revision; it does not copy or
155
267
  re-upload the package:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@answerlayer/cli",
3
- "version": "0.2.7",
3
+ "version": "0.3.1",
4
4
  "description": "Open-source command line client for the AnswerLayer API.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: answerlayer
3
- description: Query databases and operate customer-owned API pipelines with AnswerLayer. Use when the user wants to set up or configure AnswerLayer, connect to their data, ask analytical or business questions about a database, run SQL, or manage AnswerLayer API pipelines, connections, saved queries, the semantic layer, or dashboards.
3
+ description: Query databases and operate customer-owned API pipelines with AnswerLayer. Use when the user wants to set up or configure AnswerLayer, connect to their data, ask analytical or business questions about a database, run SQL, or manage AnswerLayer response policies, API pipelines, connections, saved queries, the semantic layer, or dashboards.
4
4
  ---
5
5
 
6
6
  # AnswerLayer
@@ -167,6 +167,34 @@ AL query run <connection-id> --file ./report.sql --format csv
167
167
  AL query validate <connection-id> --sql "select * from orders"
168
168
  ```
169
169
 
170
+ ### Manage inquiry response policies
171
+
172
+ Use `AL inquiry-policies list|get|effective --json` to inspect policies and the
173
+ default resolved for a connection. Policy mutations require the user's
174
+ confirmation. Preview configuration before creating or revising it:
175
+
176
+ ```bash
177
+ AL inquiry-policies preview \
178
+ --output-format table_first \
179
+ --precision-mode significant_figures --precision-value 4 \
180
+ --require-identifiers --require-numeric-support \
181
+ --insufficient-data ask_for_clarification \
182
+ --proxy-behavior require_confirmation \
183
+ --guidance "Lead with the result." --json
184
+ ```
185
+
186
+ After confirmation, use `create --name <name>` or `revise <policy>`, then
187
+ activate the returned revision explicitly with
188
+ `activate <policy> <revision-id-or-version>`. Set defaults with
189
+ `set-default organization <policy>` or
190
+ `set-default connection <connection-id> <policy>`.
191
+
192
+ New inquiries and eval runs inherit connection, organization, then platform
193
+ defaults. Use `--policy <id-or-name> --policy-version <number-or-revision-id>`
194
+ to pin an exact revision. Existing sessions and runs remain pinned when a later
195
+ revision is activated. Run `AL --help` for all allowed configuration values and
196
+ precision ranges.
197
+
170
198
  ### Other resources
171
199
 
172
200
  These follow `AL <group> <command>`. Run `AL <group> --help` (or `AL --help`)
@@ -179,9 +207,13 @@ to see exact flags before using one:
179
207
  - `generation` — generate semantic components, optionally grounded by an eval suite's authoring cases; holdout and adversarial cases are rejected
180
208
  - `dashboards`, `tiles` — build and read dashboards
181
209
  - `documents` — upload business-context docs and link them to connections
210
+ - `inquiry-policies` — preview, create, revise, activate, archive, and assign
211
+ versioned answer-formatting and uncertainty-handling policies
182
212
  - `connections` — create / test / inspect schema
183
213
  - `pipelines` — create, inspect, update, validate, connection-test, probe,
184
- promote, enable, disable, and archive pipelines;
214
+ promote, run with explicit dataset scope and idempotency, retry from durable
215
+ checkpoints, define unarmed install-local schedules, explicitly arm or pause
216
+ schedules, enable, disable, and archive;
185
217
  upload immutable packages; list, inspect, diff, validate, promote, and roll
186
218
  back revisions; and run/retry/cancel exact revisions. Use `--wait --json` for
187
219
  automation. Never put credentials or CA material in package configuration;
package/src/cli.js CHANGED
@@ -55,6 +55,7 @@ export async function main(argv, io) {
55
55
  if (group === "query-results" || group === "results") return handleQueryResults(client, command, positionals, parsed, io);
56
56
  if (group === "saved-queries" || group === "saved") return handleSavedQueries(client, command, positionals, parsed, io);
57
57
  if (group === "semantic") return handleSemantic(client, command, positionals, parsed, io);
58
+ if (group === "inquiry-policies" || group === "policies") return handleInquiryPolicies(client, command, positionals, parsed, io);
58
59
  if (group === "inquiry") return handleInquiry(client, command, positionals, parsed, io);
59
60
  if (group === "evals" || group === "evaluations") return handleEvals(client, command, positionals, parsed, io);
60
61
  if (group === "optimize" || group === "optimization" || group === "semantic-optimization") {
@@ -279,6 +280,10 @@ async function handlePipelines(client, command, positionals, parsed, io) {
279
280
  return handlePipelineRuns(client, base, positionals, parsed, io);
280
281
  }
281
282
 
283
+ if (command === "schedule" || command === "schedules") {
284
+ return handlePipelineSchedule(client, base, positionals, parsed, io);
285
+ }
286
+
282
287
  throw usage(`Unknown pipelines command: ${command}`);
283
288
  }
284
289
 
@@ -376,6 +381,10 @@ async function handlePipelineRuns(client, base, positionals, parsed, io) {
376
381
  const pipelinePath = `${base}/${encodeURIComponent(pipelineId)}`;
377
382
 
378
383
  if (action === "start" || action === "run") {
384
+ const body = await readData(parsed.flags, io, {
385
+ datasets: optionalCsvOrRepeated(parsed.flags.dataset),
386
+ idempotency_key: firstValue(parsed.flags.idempotencyKey),
387
+ });
379
388
  return requestWaitAndPrint(
380
389
  client,
381
390
  "POST",
@@ -383,6 +392,7 @@ async function handlePipelineRuns(client, base, positionals, parsed, io) {
383
392
  parsed,
384
393
  io,
385
394
  pipelinePath,
395
+ { body },
386
396
  );
387
397
  }
388
398
 
@@ -392,6 +402,9 @@ async function handlePipelineRuns(client, base, positionals, parsed, io) {
392
402
  return requestAndPrint(client, "GET", runPath, parsed, io);
393
403
  }
394
404
  if (action === "retry") {
405
+ const body = await readData(parsed.flags, io, {
406
+ idempotency_key: firstValue(parsed.flags.idempotencyKey),
407
+ });
395
408
  return requestWaitAndPrint(
396
409
  client,
397
410
  "POST",
@@ -399,6 +412,7 @@ async function handlePipelineRuns(client, base, positionals, parsed, io) {
399
412
  parsed,
400
413
  io,
401
414
  pipelinePath,
415
+ { body },
402
416
  );
403
417
  }
404
418
  if (action === "cancel") {
@@ -408,6 +422,50 @@ async function handlePipelineRuns(client, base, positionals, parsed, io) {
408
422
  throw usage(`Unknown pipelines runs command: ${action}`);
409
423
  }
410
424
 
425
+ async function handlePipelineSchedule(client, base, positionals, parsed, io) {
426
+ const action = requirePositional(positionals, 0, "pipeline schedule action");
427
+ const pipelineId = requirePositional(positionals, 1, "pipeline id");
428
+ const schedulePath = `${base}/${encodeURIComponent(pipelineId)}/schedule`;
429
+
430
+ if (action === "get") {
431
+ return requestAndPrint(client, "GET", schedulePath, parsed, io);
432
+ }
433
+ if (action === "set" || action === "create") {
434
+ if (parsed.flags.armed && parsed.flags.paused) {
435
+ throw usage("pipelines schedule set accepts either --armed or --paused, not both");
436
+ }
437
+ const body = await readData(parsed.flags, io, {
438
+ schedule_expression: firstValue(parsed.flags.expression),
439
+ enabled: Boolean(parsed.flags.armed),
440
+ });
441
+ requirePayloadValue(
442
+ body,
443
+ "schedule_expression",
444
+ "pipelines schedule set requires --expression",
445
+ );
446
+ return requestAndPrint(client, "PUT", schedulePath, parsed, io, { body });
447
+ }
448
+ if (action === "update") {
449
+ const body = await readData(parsed.flags, io, {
450
+ schedule_expression: firstValue(parsed.flags.expression),
451
+ });
452
+ requirePayloadValue(
453
+ body,
454
+ "schedule_expression",
455
+ "pipelines schedule update requires --expression",
456
+ );
457
+ return requestAndPrint(client, "PATCH", schedulePath, parsed, io, { body });
458
+ }
459
+ if (action === "pause" || action === "resume") {
460
+ return requestAndPrint(client, "POST", `${schedulePath}/${action}`, parsed, io);
461
+ }
462
+ if (action === "delete" || action === "remove") {
463
+ return requestAndPrint(client, "DELETE", schedulePath, parsed, io);
464
+ }
465
+
466
+ throw usage(`Unknown pipelines schedule command: ${action}`);
467
+ }
468
+
411
469
  async function handleConnections(client, command, positionals, parsed, io) {
412
470
  if (command === "supported" || command === "supported-types") {
413
471
  return requestAndPrint(client, "GET", "/api/v1/connections/supported_types", parsed, io, {
@@ -737,8 +795,13 @@ async function handleInquiry(client, command, positionals, parsed, io) {
737
795
  let sessionId = firstValue(parsed.flags.session);
738
796
  if (!sessionId) {
739
797
  if (!connectionId) throw usage("inquiry ask requires --connection when --session is not provided");
798
+ const policy = await resolvePolicySelection(client, parsed.flags);
740
799
  const session = await client.request("POST", "/api/v1/inquiry/sessions", {
741
- body: { connection_id: connectionId, model: firstValue(parsed.flags.model) },
800
+ body: {
801
+ connection_id: connectionId,
802
+ model: firstValue(parsed.flags.model),
803
+ ...policy,
804
+ },
742
805
  });
743
806
  sessionId = session.session_id;
744
807
  }
@@ -776,10 +839,12 @@ async function handleInquiry(client, command, positionals, parsed, io) {
776
839
  }
777
840
 
778
841
  if (command === "create-session") {
842
+ const policy = await resolvePolicySelection(client, parsed.flags);
779
843
  return requestAndPrint(client, "POST", "/api/v1/inquiry/sessions", parsed, io, {
780
844
  body: await readData(parsed.flags, io, {
781
845
  connection_id: firstValue(parsed.flags.connection),
782
846
  model: firstValue(parsed.flags.model),
847
+ ...policy,
783
848
  }),
784
849
  });
785
850
  }
@@ -813,6 +878,198 @@ async function handleInquiry(client, command, positionals, parsed, io) {
813
878
  throw usage(`Unknown inquiry command: ${command}`);
814
879
  }
815
880
 
881
+ async function handleInquiryPolicies(client, command, positionals, parsed, io) {
882
+ const base = "/api/v1/inquiry-policies";
883
+ if (command === "list" || !command) {
884
+ return requestAndPrint(client, "GET", base, parsed, io, {
885
+ query: { include_archived: parsed.flags.includeArchived || undefined },
886
+ table: [
887
+ { key: "id", label: "ID" },
888
+ { key: "name", label: "Name" },
889
+ { key: "status", label: "Status" },
890
+ { key: "active_version", label: "Version" },
891
+ { key: "active_content_sha256", label: "Content hash" },
892
+ ],
893
+ });
894
+ }
895
+
896
+ if (["create", "preview"].includes(command)) {
897
+ const payload = await readData(parsed.flags, io, policyContentPayload(parsed.flags, {
898
+ includeMetadata: command === "create",
899
+ }));
900
+ if (command === "create") {
901
+ requirePayloadValue(payload, "name", "inquiry-policies create requires --name");
902
+ }
903
+ return requestAndPrint(client, "POST", command === "preview" ? `${base}/preview` : base, parsed, io, {
904
+ body: payload,
905
+ });
906
+ }
907
+
908
+ if (command === "effective") {
909
+ const connectionId = firstValue(parsed.flags.connection) || positionals[0];
910
+ if (!connectionId) throw usage("inquiry-policies effective requires --connection");
911
+ return requestAndPrint(client, "GET", `${base}/defaults/effective`, parsed, io, {
912
+ query: { connection_id: connectionId },
913
+ });
914
+ }
915
+
916
+ if (command === "set-default") {
917
+ const scope = positionals[0];
918
+ const policyRef = positionals[scope === "connection" ? 2 : 1] || firstValue(parsed.flags.policy);
919
+ if (!policyRef) throw usage("inquiry-policies set-default requires a policy id or name");
920
+ const { policy_id } = await resolvePolicySelection(client, { policy: policyRef });
921
+ if (scope === "organization" || scope === "org") {
922
+ return requestAndPrint(client, "PUT", `${base}/defaults/organization`, parsed, io, {
923
+ body: { policy_id },
924
+ });
925
+ }
926
+ if (scope === "connection") {
927
+ const connectionId = positionals[1] || firstValue(parsed.flags.connection);
928
+ if (!connectionId) throw usage("connection default requires a connection id");
929
+ return requestAndPrint(client, "PUT", `${base}/defaults/connections/${encodeURIComponent(connectionId)}`, parsed, io, {
930
+ body: { policy_id },
931
+ });
932
+ }
933
+ throw usage("Expected inquiry-policies set-default organization|connection");
934
+ }
935
+
936
+ if (command === "clear-default") {
937
+ const scope = positionals[0];
938
+ if (scope === "organization" || scope === "org") {
939
+ return requestAndPrint(client, "DELETE", `${base}/defaults/organization`, parsed, io);
940
+ }
941
+ if (scope === "connection") {
942
+ const connectionId = positionals[1] || firstValue(parsed.flags.connection);
943
+ if (!connectionId) throw usage("connection default requires a connection id");
944
+ return requestAndPrint(client, "DELETE", `${base}/defaults/connections/${encodeURIComponent(connectionId)}`, parsed, io);
945
+ }
946
+ throw usage("Expected inquiry-policies clear-default organization|connection");
947
+ }
948
+
949
+ const policyRef = positionals[0] || firstValue(parsed.flags.policy);
950
+ if (!policyRef) throw usage(`inquiry-policies ${command} requires a policy id or name`);
951
+ const { policy_id: policyId } = await resolvePolicySelection(client, { policy: policyRef });
952
+ if (command === "get") {
953
+ return requestAndPrint(client, "GET", `${base}/${encodeURIComponent(policyId)}`, parsed, io);
954
+ }
955
+ if (command === "revise") {
956
+ return requestAndPrint(client, "POST", `${base}/${encodeURIComponent(policyId)}/revisions`, parsed, io, {
957
+ body: await readData(parsed.flags, io, {
958
+ ...policyContentPayload(parsed.flags),
959
+ base_revision_id: firstValue(parsed.flags.baseRevision),
960
+ }),
961
+ });
962
+ }
963
+ if (command === "activate") {
964
+ const revisionRef = positionals[1] || firstValue(parsed.flags.policyVersion);
965
+ if (!revisionRef) throw usage("inquiry-policies activate requires a revision id or version");
966
+ const { policy_revision_id: revisionId } = await resolvePolicySelection(client, {
967
+ policy: policyId,
968
+ policyVersion: revisionRef,
969
+ });
970
+ return requestAndPrint(client, "POST", `${base}/${encodeURIComponent(policyId)}/revisions/${encodeURIComponent(revisionId)}/activate`, parsed, io);
971
+ }
972
+ if (command === "archive" || command === "delete") {
973
+ return requestAndPrint(client, "POST", `${base}/${encodeURIComponent(policyId)}/archive`, parsed, io);
974
+ }
975
+ throw usage(`Unknown inquiry-policies command: ${command}`);
976
+ }
977
+
978
+ function policyContentPayload(flags, { includeMetadata = false } = {}) {
979
+ if (flags.requireIdentifiers && flags.noRequireIdentifiers) {
980
+ throw usage("Use only one of --require-identifiers or --no-require-identifiers");
981
+ }
982
+ if (flags.requireNumericSupport && flags.noRequireNumericSupport) {
983
+ throw usage("Use only one of --require-numeric-support or --no-require-numeric-support");
984
+ }
985
+ const evidence = dropUndefined({
986
+ require_identifiers: flags.requireIdentifiers
987
+ ? true
988
+ : (flags.noRequireIdentifiers ? false : undefined),
989
+ require_numeric_support: flags.requireNumericSupport
990
+ ? true
991
+ : (flags.noRequireNumericSupport ? false : undefined),
992
+ });
993
+ const outputFormat = enumFlag(flags.outputFormat, "output-format", [
994
+ "concise", "narrative", "table_first",
995
+ ]);
996
+ const insufficientDataBehavior = enumFlag(flags.insufficientData, "insufficient-data", [
997
+ "explain_and_stop", "ask_for_clarification", "conditional_proxy",
998
+ ]);
999
+ const proxyBehavior = enumFlag(flags.proxyBehavior, "proxy-behavior", [
1000
+ "forbid_unconfirmed", "require_confirmation", "allow_with_prominent_qualification",
1001
+ ]);
1002
+ const config = dropUndefined({
1003
+ output_format: outputFormat,
1004
+ numeric_precision: policyNumericPrecision(flags),
1005
+ insufficient_data_behavior: insufficientDataBehavior,
1006
+ proxy_behavior: proxyBehavior,
1007
+ evidence: Object.keys(evidence).length ? evidence : undefined,
1008
+ });
1009
+ return dropUndefined({
1010
+ ...(includeMetadata ? {
1011
+ name: firstValue(flags.name),
1012
+ description: firstValue(flags.description),
1013
+ } : {}),
1014
+ config: Object.keys(config).length ? config : undefined,
1015
+ administrator_guidance: firstValue(flags.guidance),
1016
+ });
1017
+ }
1018
+
1019
+ function policyNumericPrecision(flags) {
1020
+ const mode = enumFlag(flags.precisionMode, "precision-mode", [
1021
+ "preserve_source", "minimum_decimal_places", "significant_figures",
1022
+ ]);
1023
+ const rawValue = firstValue(flags.precisionValue);
1024
+ if (!mode) {
1025
+ if (rawValue !== undefined) throw usage("--precision-value requires --precision-mode");
1026
+ return undefined;
1027
+ }
1028
+ if (mode === "preserve_source") {
1029
+ if (rawValue !== undefined) throw usage("--precision-mode preserve_source does not accept --precision-value");
1030
+ return { mode };
1031
+ }
1032
+ if (rawValue === undefined || rawValue === "") {
1033
+ throw usage(`--precision-mode ${mode} requires --precision-value`);
1034
+ }
1035
+ const [minimum, maximum] = mode === "minimum_decimal_places" ? [0, 10] : [1, 15];
1036
+ return {
1037
+ mode,
1038
+ value: parseBoundedInteger(rawValue, "precision-value", minimum, maximum),
1039
+ };
1040
+ }
1041
+
1042
+ async function resolvePolicySelection(client, flags) {
1043
+ const reference = firstValue(flags.policy);
1044
+ const versionReference = firstValue(flags.policyVersion);
1045
+ if (!reference) {
1046
+ if (versionReference) throw usage("--policy-version requires --policy");
1047
+ return {};
1048
+ }
1049
+ let policyId = reference;
1050
+ if (!isUuid(reference)) {
1051
+ const policies = await client.request("GET", "/api/v1/inquiry-policies");
1052
+ const matches = policies.filter((policy) => policy.name.toLowerCase() === reference.toLowerCase());
1053
+ if (matches.length !== 1) {
1054
+ throw usage(matches.length ? `Policy name is ambiguous: ${reference}` : `Policy not found: ${reference}`);
1055
+ }
1056
+ policyId = matches[0].id;
1057
+ }
1058
+ if (!versionReference) return { policy_id: policyId };
1059
+ if (isUuid(versionReference)) {
1060
+ return { policy_id: policyId, policy_revision_id: versionReference };
1061
+ }
1062
+ const version = parsePositiveInteger(versionReference, "policy-version");
1063
+ const policy = await client.request("GET", `/api/v1/inquiry-policies/${encodeURIComponent(policyId)}`);
1064
+ const revision = policy.revisions.find((item) => item.version === version);
1065
+ if (!revision) throw usage(`Policy ${reference} has no version ${version}`);
1066
+ return { policy_id: policyId, policy_revision_id: revision.id };
1067
+ }
1068
+
1069
+ function isUuid(value) {
1070
+ return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
1071
+ }
1072
+
816
1073
  async function handleEvals(client, resource, positionals, parsed, io) {
817
1074
  const [command, ...rest] = positionals;
818
1075
  const base = "/api/v1/evals";
@@ -907,6 +1164,7 @@ async function handleEvals(client, resource, positionals, parsed, io) {
907
1164
  case_ids: optionalCsvOrRepeated(parsed.flags.case),
908
1165
  categories: optionalDistinctRepeated(parsed.flags.category),
909
1166
  case_concurrency: firstValue(parsed.flags.concurrency),
1167
+ ...await resolvePolicySelection(client, parsed.flags),
910
1168
  });
911
1169
  requirePayloadValue(payload, "suite_id", "evals runs create requires a suite id or --suite");
912
1170
  normalizeEvalCaseConcurrency(payload);
@@ -924,6 +1182,7 @@ async function handleEvals(client, resource, positionals, parsed, io) {
924
1182
  model: firstValue(parsed.flags.model),
925
1183
  use_semantic_layer: semanticLayerMode(parsed.flags),
926
1184
  case_concurrency: firstValue(parsed.flags.concurrency),
1185
+ ...await resolvePolicySelection(client, parsed.flags),
927
1186
  });
928
1187
  requireEvalBatchSuites(payload.suite_ids);
929
1188
  normalizeEvalCaseConcurrency(payload);
@@ -1923,6 +2182,10 @@ function normalizeFlagName(rawName) {
1923
2182
  "--against": "against",
1924
2183
  "--package": "package",
1925
2184
  "--include-archived": "includeArchived",
2185
+ "--dataset": "dataset",
2186
+ "--idempotency-key": "idempotencyKey",
2187
+ "--armed": "armed",
2188
+ "--paused": "paused",
1926
2189
  "--wait": "wait",
1927
2190
  "--wait-timeout": "waitTimeout",
1928
2191
  "--poll-interval": "pollInterval",
@@ -1965,6 +2228,19 @@ function normalizeFlagName(rawName) {
1965
2228
  "--h": "h",
1966
2229
  "--prompt": "prompt",
1967
2230
  "--model": "model",
2231
+ "--policy": "policy",
2232
+ "--policy-version": "policyVersion",
2233
+ "--base-revision": "baseRevision",
2234
+ "--guidance": "guidance",
2235
+ "--output-format": "outputFormat",
2236
+ "--precision-mode": "precisionMode",
2237
+ "--precision-value": "precisionValue",
2238
+ "--insufficient-data": "insufficientData",
2239
+ "--proxy-behavior": "proxyBehavior",
2240
+ "--require-identifiers": "requireIdentifiers",
2241
+ "--no-require-identifiers": "noRequireIdentifiers",
2242
+ "--require-numeric-support": "requireNumericSupport",
2243
+ "--no-require-numeric-support": "noRequireNumericSupport",
1968
2244
  "--mode": "mode",
1969
2245
  "--reason": "reason",
1970
2246
  "--component": "component",
@@ -2037,7 +2313,7 @@ function normalizeFlagName(rawName) {
2037
2313
  }
2038
2314
 
2039
2315
  function isBooleanFlag(rawName) {
2040
- return ["--json", "--help", "-h", "--include", "-i", "--raw", "--admin", "--force", "--follow", "--active", "--inactive", "--include-inactive", "--include-semantic-snapshot", "--include-archived", "--clear-description", "--use-semantic-layer", "--no-semantic-layer", "--no-demo", "--yes", "-y", "--wait"].includes(rawName);
2316
+ return ["--json", "--help", "-h", "--include", "-i", "--raw", "--admin", "--force", "--follow", "--active", "--inactive", "--include-inactive", "--include-semantic-snapshot", "--include-archived", "--clear-description", "--use-semantic-layer", "--no-semantic-layer", "--require-identifiers", "--no-require-identifiers", "--require-numeric-support", "--no-require-numeric-support", "--no-demo", "--yes", "-y", "--wait", "--armed", "--paused"].includes(rawName);
2041
2317
  }
2042
2318
 
2043
2319
  function setFlag(flags, name, value) {
@@ -2100,6 +2376,23 @@ function parseBoundedInteger(value, name, minimum, maximum) {
2100
2376
  return parsed;
2101
2377
  }
2102
2378
 
2379
+ function parsePositiveInteger(value, name) {
2380
+ const parsed = Number(value);
2381
+ if (!Number.isSafeInteger(parsed) || parsed < 1) {
2382
+ throw usage(`--${name} must be a positive integer or revision UUID`);
2383
+ }
2384
+ return parsed;
2385
+ }
2386
+
2387
+ function enumFlag(value, name, allowed) {
2388
+ const selected = firstValue(value);
2389
+ if (selected === undefined || selected === "") return undefined;
2390
+ if (!allowed.includes(selected)) {
2391
+ throw usage(`--${name} must be one of: ${allowed.join(", ")}`);
2392
+ }
2393
+ return selected;
2394
+ }
2395
+
2103
2396
  function requiredBoundedFlag(value, name, minimum, maximum) {
2104
2397
  const first = firstValue(value);
2105
2398
  if (first === undefined || first === "") {
@@ -2228,6 +2521,7 @@ Core:
2228
2521
  answerlayer pipelines list|create|get|update|enable|disable|archive
2229
2522
  answerlayer pipelines revisions list|get|push|validate|connection-test|probe|promote|diff|rollback <pipeline-id> [revision-id]
2230
2523
  answerlayer pipelines runs start|get|retry|cancel <pipeline-id> [run-id]
2524
+ answerlayer pipelines schedule get|set|update|pause|resume|delete <pipeline-id>
2231
2525
  answerlayer connections supported|list|get|create|update|delete|schema|test
2232
2526
  answerlayer metadata structure|tables|columns|pii-summary|pii-settings|detect-pii
2233
2527
  answerlayer query run|validate|export <connection-id> --sql <sql>
@@ -2237,6 +2531,27 @@ Data products:
2237
2531
  answerlayer saved-queries list|get|create|update|delete|approve|unapprove|execute
2238
2532
  answerlayer semantic <entities|relationships|measures|metrics|dimensions|filters> list|get|create|update|delete|delete-all|generate
2239
2533
  answerlayer inquiry models|ask|sessions|create-session|session|update-session|delete-session|turn
2534
+ answerlayer inquiry-policies list [--include-archived]
2535
+ answerlayer inquiry-policies get <policy-id-or-name>
2536
+ answerlayer inquiry-policies create --name <name> [policy options]
2537
+ answerlayer inquiry-policies revise <policy-id-or-name> [policy options]
2538
+ answerlayer inquiry-policies preview [policy options]
2539
+ answerlayer inquiry-policies activate <policy-id-or-name> <revision-id-or-version>
2540
+ answerlayer inquiry-policies archive <policy-id-or-name>
2541
+ answerlayer inquiry-policies effective --connection <connection-id>
2542
+ answerlayer inquiry-policies set-default organization <policy-id-or-name>
2543
+ answerlayer inquiry-policies set-default connection <connection-id> <policy-id-or-name>
2544
+ answerlayer inquiry-policies clear-default organization
2545
+ answerlayer inquiry-policies clear-default connection <connection-id>
2546
+ Policy options:
2547
+ --description <text> --guidance <text>
2548
+ --output-format <concise|narrative|table_first>
2549
+ --precision-mode <preserve_source|minimum_decimal_places|significant_figures>
2550
+ --precision-value <0-10 decimal places|1-15 significant figures>
2551
+ --require-identifiers|--no-require-identifiers
2552
+ --require-numeric-support|--no-require-numeric-support
2553
+ --insufficient-data <explain_and_stop|ask_for_clarification|conditional_proxy>
2554
+ --proxy-behavior <forbid_unconfirmed|require_confirmation|allow_with_prominent_qualification>
2240
2555
  answerlayer evals suites list|create|get|update|delete
2241
2556
  answerlayer evals cases create|update|delete
2242
2557
  answerlayer evals runs list|create|create-batch|get|update|cancel|compare|analyze
@@ -2248,6 +2563,8 @@ Data products:
2248
2563
  --category <name> (repeat; category and case selectors are unioned),
2249
2564
  --concurrency <1-8> (default 3; 1 is serial), and
2250
2565
  --use-semantic-layer or --no-semantic-layer
2566
+ inquiry and eval run creation accept --policy <id-or-name> and
2567
+ --policy-version <number-or-revision-id>
2251
2568
  create-batch accepts 2 to 20 suite ids as positionals or repeatable
2252
2569
  --suite values, plus shared --label, --model, --concurrency <1-8>,
2253
2570
  and --use-semantic-layer or --no-semantic-layer
@@ -2306,6 +2623,11 @@ Pipeline options:
2306
2623
  --row-limit <n> Probe row ceiling (1-100000; required).
2307
2624
  --byte-limit <n> Probe decoded-byte ceiling (1024-104857600; required).
2308
2625
  --runtime-limit <sec> Probe runtime ceiling (1-900; required).
2626
+ --dataset <name> Limit a run to a dataset (repeat or comma-separate).
2627
+ --idempotency-key <k> Safely retry a run-creation request.
2628
+ --expression <expr> EventBridge rate(...) or cron(...) schedule.
2629
+ --armed Arm a new schedule immediately (default: unarmed).
2630
+ --paused Explicitly create a schedule in the unarmed state.
2309
2631
 
2310
2632
  SQL options:
2311
2633
  --sql, -q <sql> SQL text.