@himring/cli 0.1.0 → 0.3.0
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/CHANGELOG.md +26 -0
- package/README.md +9 -9
- package/dist/main.js +612 -1196
- package/package.json +4 -4
package/dist/main.js
CHANGED
|
@@ -156,7 +156,7 @@ function exitCodeForApiError(error) {
|
|
|
156
156
|
case "invalid_response":
|
|
157
157
|
return EXIT_CODES.unexpected;
|
|
158
158
|
case "refused":
|
|
159
|
-
return exitCodeForStatus(error.status);
|
|
159
|
+
return error.isRejectedRedirect ? EXIT_CODES.usage : exitCodeForStatus(error.status);
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
function exitCodeForError(error) {
|
|
@@ -915,6 +915,7 @@ async function runCommand(context, work) {
|
|
|
915
915
|
// src/file-body-command.ts
|
|
916
916
|
import { resolve } from "node:path";
|
|
917
917
|
import { HIMRING_OPERATIONS as HIMRING_OPERATIONS2 } from "@himring/sdk";
|
|
918
|
+
import { openLocalFile as openLocalFile2 } from "@himring/sdk/folders";
|
|
918
919
|
import { Option } from "commander";
|
|
919
920
|
|
|
920
921
|
// src/bounded-file-read.ts
|
|
@@ -975,6 +976,21 @@ function choicesOf(id, field) {
|
|
|
975
976
|
function addProjectOption(command) {
|
|
976
977
|
return command.addOption(new Option("--project <value>", "project_id (required)").env(PROJECT_VARIABLE));
|
|
977
978
|
}
|
|
979
|
+
var UPLOAD_CHUNK_BYTES = 1024 * 1024;
|
|
980
|
+
function streamFile(file) {
|
|
981
|
+
let offset = 0;
|
|
982
|
+
return new ReadableStream({
|
|
983
|
+
async pull(controller) {
|
|
984
|
+
if (offset === file.sizeBytes) {
|
|
985
|
+
controller.close();
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
const end = Math.min(file.sizeBytes, offset + UPLOAD_CHUNK_BYTES);
|
|
989
|
+
controller.enqueue(await file.read(offset, end));
|
|
990
|
+
offset = end;
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
}
|
|
978
994
|
async function sendFileBody(context, request) {
|
|
979
995
|
const description = HIMRING_OPERATIONS2[request.id];
|
|
980
996
|
if (description.body !== "file") throw new Error(`${request.id} takes no file.`);
|
|
@@ -982,19 +998,26 @@ async function sendFileBody(context, request) {
|
|
|
982
998
|
const input = definedFieldsOf(request.input);
|
|
983
999
|
checkInput(request.id, input, request.suggestion);
|
|
984
1000
|
const absolutePath = resolve(request.from);
|
|
985
|
-
const
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1001
|
+
const opened = await openLocalFile2(absolutePath).catch(() => void 0);
|
|
1002
|
+
if (!opened) throw new UsageError(`${request.from} is not a readable file.`, "Pass the path of a readable file.");
|
|
1003
|
+
try {
|
|
1004
|
+
if (opened.sizeBytes > description.maximumBodyBytes) {
|
|
1005
|
+
throw new UsageError(
|
|
1006
|
+
`${request.from} holds more than ${sizeText(description.maximumBodyBytes)}.`,
|
|
1007
|
+
request.splitHint
|
|
1008
|
+
);
|
|
1009
|
+
}
|
|
1010
|
+
if (request.dryRun) {
|
|
1011
|
+
const sent = withoutPathFields(request.id, input);
|
|
1012
|
+
return dryRunOf(request.id, input, { ...sent, from: absolutePath, size_bytes: opened.sizeBytes });
|
|
1013
|
+
}
|
|
1014
|
+
const content = streamFile(opened);
|
|
1015
|
+
const result = await (await signedInClient(context)).invoke(request.id, { ...input, content });
|
|
1016
|
+
checkOutput(request.id, result);
|
|
1017
|
+
return result;
|
|
1018
|
+
} finally {
|
|
1019
|
+
await opened.close();
|
|
994
1020
|
}
|
|
995
|
-
const result = await (await signedInClient(context)).invoke(request.id, { ...input, content });
|
|
996
|
-
checkOutput(request.id, result);
|
|
997
|
-
return result;
|
|
998
1021
|
}
|
|
999
1022
|
|
|
1000
1023
|
// src/answer-log-commands.ts
|
|
@@ -1405,7 +1428,7 @@ async function placeWithoutReplacing(temporary, target) {
|
|
|
1405
1428
|
async function saveDownloadTo(result, target) {
|
|
1406
1429
|
if (!isDownload(result))
|
|
1407
1430
|
throw new HimringApiError2("invalid_response", "The API answered the download without a file.");
|
|
1408
|
-
const path = resolve3(target.out ?? safeDownloadName(result.file_name, FALLBACK_FILE_NAME));
|
|
1431
|
+
const path = resolve3(target.out ?? safeDownloadName(result.file_name, FALLBACK_FILE_NAME, result.file_extension));
|
|
1409
1432
|
if (!target.force && await exists(path)) {
|
|
1410
1433
|
await result.body.cancel().catch(() => void 0);
|
|
1411
1434
|
throw alreadyExists(path);
|
|
@@ -1833,7 +1856,7 @@ function addIndexRecordFileCommands(program, contextFor, recordExitCode) {
|
|
|
1833
1856
|
}
|
|
1834
1857
|
|
|
1835
1858
|
// src/operation-commands.ts
|
|
1836
|
-
import { HIMRING_OPERATIONS as HIMRING_OPERATIONS3 } from "@himring/sdk";
|
|
1859
|
+
import { HIMRING_OPERATION_IDS, HIMRING_OPERATIONS as HIMRING_OPERATIONS3 } from "@himring/sdk";
|
|
1837
1860
|
import { HIMRING_OPERATION_CATALOGUE as HIMRING_OPERATION_CATALOGUE5 } from "@himring/sdk/catalogue";
|
|
1838
1861
|
|
|
1839
1862
|
// src/operation-fields.ts
|
|
@@ -1915,13 +1938,14 @@ function kindOfAnyOf(options) {
|
|
|
1915
1938
|
if (only !== void 0 && present.length === 1) {
|
|
1916
1939
|
const kind = kindOf(only);
|
|
1917
1940
|
if (present.length === options.length) return kind;
|
|
1918
|
-
return kind === "
|
|
1941
|
+
return kind === "list" ? "json" : kind;
|
|
1919
1942
|
}
|
|
1920
1943
|
return present.length > 0 && present.every(isObjectSchema) ? "json" : "scalar";
|
|
1921
1944
|
}
|
|
1922
1945
|
function kindOf(schema) {
|
|
1923
1946
|
const options = optionsOf2(schema);
|
|
1924
1947
|
if (options.length > 0) return kindOfAnyOf(options);
|
|
1948
|
+
if (schema.type === "integer" || schema.type === "number") return schema.type;
|
|
1925
1949
|
if (schema.type === "boolean") return "boolean";
|
|
1926
1950
|
if (schema.type === "array") {
|
|
1927
1951
|
return isRecord(schema.items) && schema.items.type === "string" && schema.items.enum === void 0 ? "list" : "json";
|
|
@@ -1957,6 +1981,17 @@ function parseBoolean(value) {
|
|
|
1957
1981
|
if (value === "false") return false;
|
|
1958
1982
|
throw new InvalidArgumentError2("Pass true or false.");
|
|
1959
1983
|
}
|
|
1984
|
+
function parseNumber(value) {
|
|
1985
|
+
if (!/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/.test(value)) throw new InvalidArgumentError2("Pass a number.");
|
|
1986
|
+
const parsed = Number(value);
|
|
1987
|
+
if (!Number.isFinite(parsed)) throw new InvalidArgumentError2("Pass a finite number.");
|
|
1988
|
+
return parsed;
|
|
1989
|
+
}
|
|
1990
|
+
function parseInteger(value) {
|
|
1991
|
+
if (!/^-?(?:0|[1-9]\d*)$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
1992
|
+
throw new InvalidArgumentError2("Pass a safe whole number.");
|
|
1993
|
+
return Number(value);
|
|
1994
|
+
}
|
|
1960
1995
|
function parseList(value) {
|
|
1961
1996
|
return value.split(LIST_SEPARATOR2).map((item) => item.trim()).filter((item) => item.length > 0);
|
|
1962
1997
|
}
|
|
@@ -1967,6 +2002,8 @@ function addFieldOptions(command, fields) {
|
|
|
1967
2002
|
for (const field of fields) {
|
|
1968
2003
|
const placeholder = field.kind === "json" ? "<path>" : "<value>";
|
|
1969
2004
|
const option = new Option8(`--${field.flag} ${placeholder}`, field.help);
|
|
2005
|
+
if (field.kind === "number") option.argParser(parseNumber);
|
|
2006
|
+
if (field.kind === "integer") option.argParser(parseInteger);
|
|
1970
2007
|
if (field.kind === "boolean") option.argParser(parseBoolean);
|
|
1971
2008
|
if (field.kind === "list") option.argParser(parseList);
|
|
1972
2009
|
if (field.name === PROJECT_FIELD) option.env(PROJECT_VARIABLE2);
|
|
@@ -2011,133 +2048,53 @@ var DATABASE_WORKSPACE_RESOURCE_DESCRIPTIONS = {
|
|
|
2011
2048
|
var DB = "--database db_3a9e5c7b1d2f4e6a8c0b9d7f5e3a1c2b";
|
|
2012
2049
|
var TABLE = "--table-name orders";
|
|
2013
2050
|
var IMPORT = "--import 9f2c4e6a8b0d1f3e5a7c9b1d3f5e7a9c";
|
|
2014
|
-
var
|
|
2015
|
-
list_database_tables: {
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
verb: "list",
|
|
2062
|
-
examples: [`himring saved-queries list ${DB}`, `himring saved-queries list ${DB} --output json`]
|
|
2063
|
-
},
|
|
2064
|
-
save_query: {
|
|
2065
|
-
resource: "saved-queries",
|
|
2066
|
-
verb: "save",
|
|
2067
|
-
examples: [`himring saved-queries save ${DB} --name "Open orders" --sql-file open-orders.sql`]
|
|
2068
|
-
},
|
|
2069
|
-
delete_saved_query: {
|
|
2070
|
-
resource: "saved-queries",
|
|
2071
|
-
verb: "delete",
|
|
2072
|
-
confirm: true,
|
|
2073
|
-
examples: [`himring saved-queries delete ${DB} --saved-query sql_5c1e9a3b7d2f4e6a8c0b9d7f5e3a1c2b --yes`]
|
|
2074
|
-
},
|
|
2075
|
-
propose_database_change: {
|
|
2076
|
-
resource: "change-proposals",
|
|
2077
|
-
verb: "create",
|
|
2078
|
-
examples: [
|
|
2079
|
-
`himring change-proposals create ${DB} --request "Add a delivered_at column to orders"`,
|
|
2080
|
-
`himring change-proposals create ${DB} --request "Split customers.name into first and last names" --output json`
|
|
2081
|
-
]
|
|
2082
|
-
},
|
|
2083
|
-
preview_table_column_changes: {
|
|
2084
|
-
resource: "columns",
|
|
2085
|
-
verb: "preview",
|
|
2086
|
-
examples: [
|
|
2087
|
-
`echo '[{"kind":"alter","column":"total","type":"real"}]' | himring columns preview ${DB} ${TABLE} --changes-file -`,
|
|
2088
|
-
`himring columns preview ${DB} ${TABLE} --changes-file changes.json --output json`
|
|
2089
|
-
]
|
|
2090
|
-
},
|
|
2091
|
-
change_table_columns: {
|
|
2092
|
-
resource: "columns",
|
|
2093
|
-
verb: "change",
|
|
2094
|
-
confirm: true,
|
|
2095
|
-
examples: [
|
|
2096
|
-
`echo '[{"kind":"add","name":"delivered_at","type":"datetime"}]' | himring columns change ${DB} ${TABLE} --changes-file - --expected-migration-version 4 --yes`
|
|
2097
|
-
]
|
|
2098
|
-
},
|
|
2099
|
-
preview_create_table: {
|
|
2100
|
-
resource: "tables",
|
|
2101
|
-
verb: "preview",
|
|
2102
|
-
examples: [
|
|
2103
|
-
`echo '[{"name":"id","type":"integer","primary_key":true},{"name":"email","type":"text","not_null":true,"unique":true}]' | himring tables preview ${DB} --table-name customers --columns-file -`
|
|
2104
|
-
]
|
|
2105
|
-
},
|
|
2106
|
-
create_table: {
|
|
2107
|
-
resource: "tables",
|
|
2108
|
-
verb: "create",
|
|
2109
|
-
examples: [
|
|
2110
|
-
`himring tables create ${DB} --table-name customers --columns-file columns.json --expected-migration-version 3`,
|
|
2111
|
-
`himring tables create ${DB} --table-name customers --columns-file columns.json --expected-migration-version 3 --output json`
|
|
2112
|
-
]
|
|
2113
|
-
},
|
|
2114
|
-
export_table_rows: {
|
|
2115
|
-
resource: "rows",
|
|
2116
|
-
verb: "export",
|
|
2117
|
-
examples: [
|
|
2118
|
-
`himring rows export ${DB} ${TABLE} --format csv --out orders.csv`,
|
|
2119
|
-
`echo '[{"column":"status","operator":"eq","value":"open"}]' | himring rows export ${DB} ${TABLE} --format sql --filters-file -`
|
|
2120
|
-
]
|
|
2121
|
-
},
|
|
2122
|
-
check_table_import: {
|
|
2123
|
-
resource: "imports",
|
|
2124
|
-
verb: "check",
|
|
2125
|
-
examples: [
|
|
2126
|
-
`echo '[{"source_index":0,"column_name":"id"},{"source_index":1,"column_name":"status"}]' | himring imports check ${DB} ${IMPORT} ${TABLE} --columns-file -`
|
|
2127
|
-
]
|
|
2128
|
-
},
|
|
2129
|
-
apply_table_import: {
|
|
2130
|
-
resource: "imports",
|
|
2131
|
-
verb: "apply",
|
|
2132
|
-
examples: [
|
|
2133
|
-
`himring imports apply ${DB} ${IMPORT} ${TABLE} --columns-file columns.json --expected-failed 0 --expected-migration-version 4`
|
|
2134
|
-
]
|
|
2135
|
-
},
|
|
2136
|
-
discard_table_import: {
|
|
2137
|
-
resource: "imports",
|
|
2138
|
-
verb: "discard",
|
|
2139
|
-
examples: [`himring imports discard ${DB} ${IMPORT}`]
|
|
2140
|
-
}
|
|
2051
|
+
var DATABASE_WORKSPACE_EXAMPLES = {
|
|
2052
|
+
list_database_tables: [`himring tables list ${DB}`, `himring tables list ${DB} --output json`],
|
|
2053
|
+
list_table_rows: [
|
|
2054
|
+
`himring rows list ${DB} ${TABLE}`,
|
|
2055
|
+
`himring rows list ${DB} ${TABLE} --filters-file filters.json --sorts-file sorts.json --page-size 50 --output json`
|
|
2056
|
+
],
|
|
2057
|
+
get_table_row: [`echo '[42]' | himring rows get ${DB} ${TABLE} --key-file -`],
|
|
2058
|
+
insert_table_row: [`echo '{"customer_id":1042,"total":120}' | himring rows add ${DB} ${TABLE} --values-file -`],
|
|
2059
|
+
update_table_row: [`himring rows update ${DB} ${TABLE} --input-file change.json --yes`],
|
|
2060
|
+
delete_table_rows: [`echo '[[42],[43]]' | himring rows delete ${DB} ${TABLE} --keys-file - --yes`],
|
|
2061
|
+
run_database_sql: [
|
|
2062
|
+
`himring sql run ${DB} --sql "SELECT status, count(*) FROM orders GROUP BY status"`,
|
|
2063
|
+
`himring sql run ${DB} --sql "UPDATE orders SET status = 'shipped' WHERE id = 42"`,
|
|
2064
|
+
`himring sql run ${DB} --sql-file archive.sql --confirmation-token "$TOKEN" --output json`
|
|
2065
|
+
],
|
|
2066
|
+
list_saved_queries: [`himring saved-queries list ${DB}`, `himring saved-queries list ${DB} --output json`],
|
|
2067
|
+
save_query: [`himring saved-queries save ${DB} --name "Open orders" --sql-file open-orders.sql`],
|
|
2068
|
+
delete_saved_query: [`himring saved-queries delete ${DB} --saved-query sql_5c1e9a3b7d2f4e6a8c0b9d7f5e3a1c2b --yes`],
|
|
2069
|
+
propose_database_change: [
|
|
2070
|
+
`himring change-proposals create ${DB} --request "Add a delivered_at column to orders"`,
|
|
2071
|
+
`himring change-proposals create ${DB} --request "Split customers.name into first and last names" --output json`
|
|
2072
|
+
],
|
|
2073
|
+
preview_table_column_changes: [
|
|
2074
|
+
`echo '[{"kind":"alter","column":"total","type":"real"}]' | himring columns preview ${DB} ${TABLE} --changes-file -`,
|
|
2075
|
+
`himring columns preview ${DB} ${TABLE} --changes-file changes.json --output json`
|
|
2076
|
+
],
|
|
2077
|
+
change_table_columns: [
|
|
2078
|
+
`echo '[{"kind":"add","name":"delivered_at","type":"datetime"}]' | himring columns change ${DB} ${TABLE} --changes-file - --expected-migration-version 4 --yes`
|
|
2079
|
+
],
|
|
2080
|
+
preview_create_table: [
|
|
2081
|
+
`echo '[{"name":"id","type":"integer","primary_key":true},{"name":"email","type":"text","not_null":true,"unique":true}]' | himring tables preview ${DB} --table-name customers --columns-file -`
|
|
2082
|
+
],
|
|
2083
|
+
create_table: [
|
|
2084
|
+
`himring tables create ${DB} --table-name customers --columns-file columns.json --expected-migration-version 3`,
|
|
2085
|
+
`himring tables create ${DB} --table-name customers --columns-file columns.json --expected-migration-version 3 --output json`
|
|
2086
|
+
],
|
|
2087
|
+
export_table_rows: [
|
|
2088
|
+
`himring rows export ${DB} ${TABLE} --format csv --out orders.csv`,
|
|
2089
|
+
`echo '[{"column":"status","operator":"eq","value":"open"}]' | himring rows export ${DB} ${TABLE} --format sql --filters-file -`
|
|
2090
|
+
],
|
|
2091
|
+
check_table_import: [
|
|
2092
|
+
`echo '[{"source_index":0,"column_name":"id"},{"source_index":1,"column_name":"status"}]' | himring imports check ${DB} ${IMPORT} ${TABLE} --columns-file -`
|
|
2093
|
+
],
|
|
2094
|
+
apply_table_import: [
|
|
2095
|
+
`himring imports apply ${DB} ${IMPORT} ${TABLE} --columns-file columns.json --expected-failed 0 --expected-migration-version 4`
|
|
2096
|
+
],
|
|
2097
|
+
discard_table_import: [`himring imports discard ${DB} ${IMPORT}`]
|
|
2141
2098
|
};
|
|
2142
2099
|
|
|
2143
2100
|
// src/flagged-question-specs.ts
|
|
@@ -2147,53 +2104,31 @@ var FLAGGED_QUESTION_RESOURCE_DESCRIPTIONS = {
|
|
|
2147
2104
|
};
|
|
2148
2105
|
var KB = "--knowledge-base kb_3f9a0c1e2d4b6a8c0e2f4a6b8c0d2e4f";
|
|
2149
2106
|
var QUESTION = "--question qst_6d8f0a2c4e1b3d5f7a9c0e2b4d6f8a1c";
|
|
2150
|
-
var
|
|
2151
|
-
record_answer_events:
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
settle_flagged_question: {
|
|
2176
|
-
resource: "flagged-questions",
|
|
2177
|
-
verb: "settle",
|
|
2178
|
-
examples: [
|
|
2179
|
-
`himring flagged-questions settle ${KB} ${QUESTION} --chunk chk_2b4d6f8a0c1e3a5c7e9b8d6f4a2c0e1b`,
|
|
2180
|
-
`himring flagged-questions settle ${KB} ${QUESTION} --file fil_0a1b2c3d4e5f60718293a4b5c6d7e8f9 --first-position 12 --last-position 14 --output json`
|
|
2181
|
-
]
|
|
2182
|
-
},
|
|
2183
|
-
dismiss_flagged_question: {
|
|
2184
|
-
resource: "flagged-questions",
|
|
2185
|
-
verb: "dismiss",
|
|
2186
|
-
confirm: true,
|
|
2187
|
-
examples: [
|
|
2188
|
-
`himring flagged-questions dismiss ${KB} ${QUESTION} --yes`,
|
|
2189
|
-
`himring flagged-questions dismiss ${KB} ${QUESTION} --dry-run`
|
|
2190
|
-
]
|
|
2191
|
-
},
|
|
2192
|
-
review_flagged_questions: {
|
|
2193
|
-
resource: "flagged-questions",
|
|
2194
|
-
verb: "review",
|
|
2195
|
-
examples: [`himring flagged-questions review ${KB}`, `himring flagged-questions review ${KB} --output json`]
|
|
2196
|
-
}
|
|
2107
|
+
var FLAGGED_QUESTION_EXAMPLES = {
|
|
2108
|
+
record_answer_events: [
|
|
2109
|
+
`echo '[{"question_id":"qst_6d8f0a2c4e1b3d5f7a9c0e2b4d6f8a1c","answer":"Refunds take 5 days."}]' | himring answer-events record ${KB} --events-file -`,
|
|
2110
|
+
`himring answer-events record ${KB} --origin sdk --events-file events.json --output json`
|
|
2111
|
+
],
|
|
2112
|
+
list_flagged_questions: [
|
|
2113
|
+
`himring flagged-questions list ${KB} --status unsure`,
|
|
2114
|
+
`himring flagged-questions list ${KB} --status unanswerable,saved --limit 20 --output json`
|
|
2115
|
+
],
|
|
2116
|
+
get_flagged_question: [
|
|
2117
|
+
`himring flagged-questions get ${KB} ${QUESTION}`,
|
|
2118
|
+
`himring flagged-questions get ${KB} ${QUESTION} --output json`
|
|
2119
|
+
],
|
|
2120
|
+
settle_flagged_question: [
|
|
2121
|
+
`himring flagged-questions settle ${KB} ${QUESTION} --chunk chk_2b4d6f8a0c1e3a5c7e9b8d6f4a2c0e1b`,
|
|
2122
|
+
`himring flagged-questions settle ${KB} ${QUESTION} --file fil_0a1b2c3d4e5f60718293a4b5c6d7e8f9 --first-position 12 --last-position 14 --output json`
|
|
2123
|
+
],
|
|
2124
|
+
dismiss_flagged_question: [
|
|
2125
|
+
`himring flagged-questions dismiss ${KB} ${QUESTION} --yes`,
|
|
2126
|
+
`himring flagged-questions dismiss ${KB} ${QUESTION} --dry-run`
|
|
2127
|
+
],
|
|
2128
|
+
review_flagged_questions: [
|
|
2129
|
+
`himring flagged-questions review ${KB}`,
|
|
2130
|
+
`himring flagged-questions review ${KB} --output json`
|
|
2131
|
+
]
|
|
2197
2132
|
};
|
|
2198
2133
|
|
|
2199
2134
|
// src/index-record-specs.ts
|
|
@@ -2201,86 +2136,48 @@ var INDEX_RECORD_RESOURCE_DESCRIPTIONS = {
|
|
|
2201
2136
|
records: "List, read, write, delete, and import the records of a search index."
|
|
2202
2137
|
};
|
|
2203
2138
|
var INDEX = "--index ix_8c4b2a0f1e3d5c7b9a8f6e4d2c0b1a3f";
|
|
2204
|
-
var
|
|
2205
|
-
update_index:
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
list_index_records: {
|
|
2247
|
-
resource: "records",
|
|
2248
|
-
verb: "list",
|
|
2249
|
-
examples: [
|
|
2250
|
-
`himring records list ${INDEX} --search refunds`,
|
|
2251
|
-
`himring records list ${INDEX} --filters '{"fields":{"category":{"eq":"billing"}}}' --output json`
|
|
2252
|
-
]
|
|
2253
|
-
},
|
|
2254
|
-
export_index_records: {
|
|
2255
|
-
resource: "records",
|
|
2256
|
-
verb: "export",
|
|
2257
|
-
examples: [`himring records export ${INDEX}`, `himring records export ${INDEX} --out articles.ndjson --force`]
|
|
2258
|
-
},
|
|
2259
|
-
get_index_record: {
|
|
2260
|
-
resource: "records",
|
|
2261
|
-
verb: "get",
|
|
2262
|
-
examples: [
|
|
2263
|
-
`himring records get ${INDEX} --record article-1042`,
|
|
2264
|
-
`himring records get ${INDEX} --record article-1042 --output json`
|
|
2265
|
-
]
|
|
2266
|
-
},
|
|
2267
|
-
save_index_record: {
|
|
2268
|
-
resource: "records",
|
|
2269
|
-
verb: "save",
|
|
2270
|
-
examples: [
|
|
2271
|
-
`himring records save ${INDEX} --record article-1042 --record-file article.json`,
|
|
2272
|
-
`cat article.json | himring records save ${INDEX} --record article-1042 --record-file -`
|
|
2273
|
-
]
|
|
2274
|
-
},
|
|
2275
|
-
delete_index_record: {
|
|
2276
|
-
resource: "records",
|
|
2277
|
-
verb: "delete",
|
|
2278
|
-
confirm: true,
|
|
2279
|
-
examples: [
|
|
2280
|
-
`himring records delete ${INDEX} --record article-1042 --yes`,
|
|
2281
|
-
`himring records delete ${INDEX} --record article-1042 --dry-run`
|
|
2282
|
-
]
|
|
2283
|
-
}
|
|
2139
|
+
var INDEX_RECORD_EXAMPLES = {
|
|
2140
|
+
update_index: [
|
|
2141
|
+
`himring indexes update ${INDEX} --language french`,
|
|
2142
|
+
`himring indexes update ${INDEX} --bm25-file bm25.json --synonyms-file synonyms.json`,
|
|
2143
|
+
`himring indexes update ${INDEX} --stop-words-file stop-words.json`
|
|
2144
|
+
],
|
|
2145
|
+
preview_index_search: [
|
|
2146
|
+
`himring indexes preview-search ${INDEX} --query "refund policy"`,
|
|
2147
|
+
`himring indexes preview-search ${INDEX} --query refunds --mode keyword --output json`,
|
|
2148
|
+
`himring indexes preview-search ${INDEX} --query refunds --offset 20 --limit 20`,
|
|
2149
|
+
`himring indexes preview-search ${INDEX} --query "refnd polcy" --tolerance 2 --boosts title:3,body:1 --term-match all`,
|
|
2150
|
+
`himring indexes preview-search ${INDEX} --query refunds --group-by topic --group-size 2 --facet-ranges-file ranges.json`
|
|
2151
|
+
],
|
|
2152
|
+
compare_index_search: [
|
|
2153
|
+
`himring indexes compare-search ${INDEX} --query "refund policy" --boosts title:3`,
|
|
2154
|
+
`himring indexes compare-search ${INDEX} --query refunds --mode keyword --bm25-file bm25.json --output json`
|
|
2155
|
+
],
|
|
2156
|
+
get_index_stats: [`himring indexes stats ${INDEX}`, `himring indexes stats ${INDEX} --output json`],
|
|
2157
|
+
suggest_index_terms: [
|
|
2158
|
+
`himring indexes suggest ${INDEX} --prefix refu`,
|
|
2159
|
+
`himring indexes suggest ${INDEX} --prefix ship --limit 5 --output json`
|
|
2160
|
+
],
|
|
2161
|
+
list_index_records: [
|
|
2162
|
+
`himring records list ${INDEX} --search refunds`,
|
|
2163
|
+
`himring records list ${INDEX} --filters '{"fields":{"category":{"eq":"billing"}}}' --output json`
|
|
2164
|
+
],
|
|
2165
|
+
export_index_records: [
|
|
2166
|
+
`himring records export ${INDEX}`,
|
|
2167
|
+
`himring records export ${INDEX} --out articles.ndjson --force`
|
|
2168
|
+
],
|
|
2169
|
+
get_index_record: [
|
|
2170
|
+
`himring records get ${INDEX} --record article-1042`,
|
|
2171
|
+
`himring records get ${INDEX} --record article-1042 --output json`
|
|
2172
|
+
],
|
|
2173
|
+
save_index_record: [
|
|
2174
|
+
`himring records save ${INDEX} --record article-1042 --record-file article.json`,
|
|
2175
|
+
`cat article.json | himring records save ${INDEX} --record article-1042 --record-file -`
|
|
2176
|
+
],
|
|
2177
|
+
delete_index_record: [
|
|
2178
|
+
`himring records delete ${INDEX} --record article-1042 --yes`,
|
|
2179
|
+
`himring records delete ${INDEX} --record article-1042 --dry-run`
|
|
2180
|
+
]
|
|
2284
2181
|
};
|
|
2285
2182
|
|
|
2286
2183
|
// src/knowledge-base-specs.ts
|
|
@@ -2293,158 +2190,76 @@ var KNOWLEDGE_BASE_RESOURCE_DESCRIPTIONS = {
|
|
|
2293
2190
|
};
|
|
2294
2191
|
var KB2 = "--knowledge-base kb_3f9a0c1e2d4b6a8c0e2f4a6b8c0d2e4f";
|
|
2295
2192
|
var FILE = "--file fil_0a1b2c3d4e5f60718293a4b5c6d7e8f9";
|
|
2296
|
-
var
|
|
2297
|
-
create_knowledge_base:
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
verb: "folder",
|
|
2367
|
-
examples: [
|
|
2368
|
-
`himring files folder ${KB2}`,
|
|
2369
|
-
`himring files folder ${KB2} --folder policies/travel --sort updated_at --direction desc --output json`
|
|
2370
|
-
]
|
|
2371
|
-
},
|
|
2372
|
-
search_folders: {
|
|
2373
|
-
resource: "files",
|
|
2374
|
-
verb: "folders",
|
|
2375
|
-
examples: [`himring files folders ${KB2}`, `himring files folders ${KB2} --search travel --output json`]
|
|
2376
|
-
},
|
|
2377
|
-
list_metadata_keys: {
|
|
2378
|
-
resource: "metadata",
|
|
2379
|
-
verb: "keys",
|
|
2380
|
-
examples: [`himring metadata keys ${KB2}`, `himring metadata keys ${KB2} --search reg --output json`]
|
|
2381
|
-
},
|
|
2382
|
-
list_metadata_values: {
|
|
2383
|
-
resource: "metadata",
|
|
2384
|
-
verb: "values",
|
|
2385
|
-
examples: [
|
|
2386
|
-
`himring metadata values ${KB2} --key region`,
|
|
2387
|
-
`himring metadata values ${KB2} --key region --search em --output json`
|
|
2388
|
-
]
|
|
2389
|
-
},
|
|
2390
|
-
get_file: {
|
|
2391
|
-
resource: "files",
|
|
2392
|
-
verb: "get",
|
|
2393
|
-
examples: [`himring files get ${KB2} ${FILE}`, `himring files get ${KB2} ${FILE} --output json`]
|
|
2394
|
-
},
|
|
2395
|
-
list_file_versions: {
|
|
2396
|
-
resource: "files",
|
|
2397
|
-
verb: "versions",
|
|
2398
|
-
examples: [
|
|
2399
|
-
`himring files versions ${KB2} ${FILE}`,
|
|
2400
|
-
`himring files versions ${KB2} ${FILE} --limit 20 --offset 20 --output json`
|
|
2401
|
-
]
|
|
2402
|
-
},
|
|
2403
|
-
list_version_blocks: {
|
|
2404
|
-
resource: "files",
|
|
2405
|
-
verb: "blocks",
|
|
2406
|
-
examples: [
|
|
2407
|
-
`himring files blocks ${KB2} ${FILE} --version 2`,
|
|
2408
|
-
`himring files blocks ${KB2} ${FILE} --version 2 --limit 200 --offset 200 --output json`,
|
|
2409
|
-
`himring files blocks ${KB2} ${FILE} --version 2 --sheet Rates --from-row 40 --limit 10`
|
|
2410
|
-
]
|
|
2411
|
-
},
|
|
2412
|
-
delete_file: {
|
|
2413
|
-
resource: "files",
|
|
2414
|
-
verb: "delete",
|
|
2415
|
-
confirm: true,
|
|
2416
|
-
examples: [`himring files delete ${KB2} ${FILE} --yes`, `himring files delete ${KB2} ${FILE} --dry-run`]
|
|
2417
|
-
},
|
|
2418
|
-
restore_file: {
|
|
2419
|
-
resource: "files",
|
|
2420
|
-
verb: "restore",
|
|
2421
|
-
examples: [`himring files restore ${KB2} ${FILE}`, `himring files restore ${KB2} ${FILE} --output json`]
|
|
2422
|
-
},
|
|
2423
|
-
get_download_link: {
|
|
2424
|
-
resource: "files",
|
|
2425
|
-
verb: "link",
|
|
2426
|
-
examples: [
|
|
2427
|
-
`himring files link ${KB2} ${FILE} --version 2`,
|
|
2428
|
-
`himring files link ${KB2} ${FILE} --version 1 --rendition pdf --disposition attachment --output json`
|
|
2429
|
-
]
|
|
2430
|
-
},
|
|
2431
|
-
list_questions: {
|
|
2432
|
-
resource: "questions",
|
|
2433
|
-
verb: "list",
|
|
2434
|
-
examples: [
|
|
2435
|
-
`himring questions list ${KB2} --search refund`,
|
|
2436
|
-
`himring questions list ${KB2} --end-user customer-42 --output json`
|
|
2437
|
-
]
|
|
2438
|
-
},
|
|
2439
|
-
erase_end_user: {
|
|
2440
|
-
resource: "end-users",
|
|
2441
|
-
verb: "erase",
|
|
2442
|
-
confirm: true,
|
|
2443
|
-
examples: [
|
|
2444
|
-
"himring end-users erase --end-user customer-42 --yes",
|
|
2445
|
-
"himring end-users erase --end-user customer-42 --dry-run"
|
|
2446
|
-
]
|
|
2447
|
-
}
|
|
2193
|
+
var KNOWLEDGE_BASE_EXAMPLES = {
|
|
2194
|
+
create_knowledge_base: [
|
|
2195
|
+
'himring knowledge-bases create --name "Support policies"',
|
|
2196
|
+
"himring knowledge-bases create --name Handbook --language french --chunk-tokens 800 --output json",
|
|
2197
|
+
'himring knowledge-bases create --name "Support policies" --question-log-retention-days 0'
|
|
2198
|
+
],
|
|
2199
|
+
list_knowledge_bases: [
|
|
2200
|
+
"himring knowledge-bases list --search support --sort name --direction asc",
|
|
2201
|
+
"himring knowledge-bases list --state deleted --sort purge_after --direction asc --output json"
|
|
2202
|
+
],
|
|
2203
|
+
get_knowledge_base: [`himring knowledge-bases get ${KB2}`, `himring knowledge-bases get ${KB2} --output json`],
|
|
2204
|
+
update_knowledge_base: [
|
|
2205
|
+
`himring knowledge-bases update ${KB2} --question-log-retention-days 90 --yes`,
|
|
2206
|
+
`himring knowledge-bases update ${KB2} --question-log-retention-days unlimited --dry-run`
|
|
2207
|
+
],
|
|
2208
|
+
delete_knowledge_base: [
|
|
2209
|
+
`himring knowledge-bases delete ${KB2} --yes`,
|
|
2210
|
+
`himring knowledge-bases delete ${KB2} --dry-run`
|
|
2211
|
+
],
|
|
2212
|
+
restore_knowledge_base: [
|
|
2213
|
+
`himring knowledge-bases restore ${KB2}`,
|
|
2214
|
+
`himring knowledge-bases restore ${KB2} --output json`
|
|
2215
|
+
],
|
|
2216
|
+
search_knowledge_base: [
|
|
2217
|
+
`himring knowledge-bases search ${KB2} --question "How long do refunds take?"`,
|
|
2218
|
+
`himring knowledge-bases search ${KB2} --question "Opening hours" --limit 3 --end-user customer-42 --output json`,
|
|
2219
|
+
`himring knowledge-bases search ${KB2} --question "Travel allowance" --folder policies/travel --metadata-file filter.json`
|
|
2220
|
+
],
|
|
2221
|
+
answer_question: [
|
|
2222
|
+
`himring knowledge-bases answer ${KB2} --question "How long do refunds take?"`,
|
|
2223
|
+
`himring knowledge-bases answer ${KB2} --question "Travel allowance" --folder policies/travel --output json`
|
|
2224
|
+
],
|
|
2225
|
+
list_files: [
|
|
2226
|
+
`himring files list ${KB2} --status failed`,
|
|
2227
|
+
`himring files list ${KB2} --search policies/ --sort path --direction asc --output json`
|
|
2228
|
+
],
|
|
2229
|
+
list_folder: [
|
|
2230
|
+
`himring files folder ${KB2}`,
|
|
2231
|
+
`himring files folder ${KB2} --folder policies/travel --sort updated_at --direction desc --output json`
|
|
2232
|
+
],
|
|
2233
|
+
search_folders: [`himring files folders ${KB2}`, `himring files folders ${KB2} --search travel --output json`],
|
|
2234
|
+
list_metadata_keys: [`himring metadata keys ${KB2}`, `himring metadata keys ${KB2} --search reg --output json`],
|
|
2235
|
+
list_metadata_values: [
|
|
2236
|
+
`himring metadata values ${KB2} --key region`,
|
|
2237
|
+
`himring metadata values ${KB2} --key region --search em --output json`
|
|
2238
|
+
],
|
|
2239
|
+
get_file: [`himring files get ${KB2} ${FILE}`, `himring files get ${KB2} ${FILE} --output json`],
|
|
2240
|
+
list_file_versions: [
|
|
2241
|
+
`himring files versions ${KB2} ${FILE}`,
|
|
2242
|
+
`himring files versions ${KB2} ${FILE} --limit 20 --offset 20 --output json`
|
|
2243
|
+
],
|
|
2244
|
+
list_version_blocks: [
|
|
2245
|
+
`himring files blocks ${KB2} ${FILE} --version 2`,
|
|
2246
|
+
`himring files blocks ${KB2} ${FILE} --version 2 --limit 200 --offset 200 --output json`,
|
|
2247
|
+
`himring files blocks ${KB2} ${FILE} --version 2 --sheet Rates --from-row 40 --limit 10`
|
|
2248
|
+
],
|
|
2249
|
+
delete_file: [`himring files delete ${KB2} ${FILE} --yes`, `himring files delete ${KB2} ${FILE} --dry-run`],
|
|
2250
|
+
restore_file: [`himring files restore ${KB2} ${FILE}`, `himring files restore ${KB2} ${FILE} --output json`],
|
|
2251
|
+
get_download_link: [
|
|
2252
|
+
`himring files link ${KB2} ${FILE} --version 2`,
|
|
2253
|
+
`himring files link ${KB2} ${FILE} --version 1 --rendition pdf --disposition attachment --output json`
|
|
2254
|
+
],
|
|
2255
|
+
list_questions: [
|
|
2256
|
+
`himring questions list ${KB2} --search refund`,
|
|
2257
|
+
`himring questions list ${KB2} --end-user customer-42 --output json`
|
|
2258
|
+
],
|
|
2259
|
+
erase_end_user: [
|
|
2260
|
+
"himring end-users erase --end-user customer-42 --yes",
|
|
2261
|
+
"himring end-users erase --end-user customer-42 --dry-run"
|
|
2262
|
+
]
|
|
2448
2263
|
};
|
|
2449
2264
|
|
|
2450
2265
|
// src/memory-review-specs.ts
|
|
@@ -2460,150 +2275,77 @@ var STORED = "--stored-memory mm_9b1d3f5a7c9e1b3d5f7a9c1e3b5d7f9a";
|
|
|
2460
2275
|
var CHANGE = "--change lrn_5e7a9c1e3a5c7e9a1c3e5a7c9e1a3c5e";
|
|
2461
2276
|
var SAVED = "--saved-question msq_8a0c2e4a6c8e0a2c4e6a8c0e2a4c6e8a";
|
|
2462
2277
|
var RECALL = "--recall rcl_1b3d5f7a9c1e3b5d7f9a1c3e5b7d9f1a";
|
|
2463
|
-
var
|
|
2464
|
-
list_memory_decisions:
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
examples: [
|
|
2535
|
-
`himring memory-webhooks set ${MEMORY} --url https://example.com/himring/events --yes`,
|
|
2536
|
-
`himring memory-webhooks set ${MEMORY} --url https://example.com/himring/events --dry-run`
|
|
2537
|
-
]
|
|
2538
|
-
},
|
|
2539
|
-
get_memory_webhook: {
|
|
2540
|
-
resource: "memory-webhooks",
|
|
2541
|
-
verb: "get",
|
|
2542
|
-
examples: [`himring memory-webhooks get ${MEMORY}`, `himring memory-webhooks get ${MEMORY} --output json`]
|
|
2543
|
-
},
|
|
2544
|
-
remove_memory_webhook: {
|
|
2545
|
-
resource: "memory-webhooks",
|
|
2546
|
-
verb: "remove",
|
|
2547
|
-
confirm: true,
|
|
2548
|
-
examples: [`himring memory-webhooks remove ${MEMORY} --yes`, `himring memory-webhooks remove ${MEMORY} --dry-run`]
|
|
2549
|
-
},
|
|
2550
|
-
list_memory_webhook_deliveries: {
|
|
2551
|
-
resource: "memory-webhooks",
|
|
2552
|
-
verb: "deliveries",
|
|
2553
|
-
examples: [
|
|
2554
|
-
`himring memory-webhooks deliveries ${MEMORY} --state waiting,failed`,
|
|
2555
|
-
`himring memory-webhooks deliveries ${MEMORY} --output json`
|
|
2556
|
-
]
|
|
2557
|
-
},
|
|
2558
|
-
list_learned_changes: {
|
|
2559
|
-
resource: "memory-learning",
|
|
2560
|
-
verb: "list",
|
|
2561
|
-
examples: [`himring memory-learning list ${MEMORY}`, `himring memory-learning list ${MEMORY} --output json`]
|
|
2562
|
-
},
|
|
2563
|
-
undo_learned_change: {
|
|
2564
|
-
resource: "memory-learning",
|
|
2565
|
-
verb: "undo",
|
|
2566
|
-
confirm: true,
|
|
2567
|
-
examples: [
|
|
2568
|
-
`himring memory-learning undo ${MEMORY} ${CHANGE} --yes`,
|
|
2569
|
-
`himring memory-learning undo ${MEMORY} ${CHANGE} --dry-run`
|
|
2570
|
-
]
|
|
2571
|
-
},
|
|
2572
|
-
tune_memory: {
|
|
2573
|
-
resource: "memory-learning",
|
|
2574
|
-
verb: "tune",
|
|
2575
|
-
examples: [`himring memory-learning tune ${MEMORY}`, `himring memory-learning tune ${MEMORY} --output json`]
|
|
2576
|
-
},
|
|
2577
|
-
get_memory_scores: {
|
|
2578
|
-
resource: "memory-learning",
|
|
2579
|
-
verb: "scores",
|
|
2580
|
-
examples: [`himring memory-learning scores ${MEMORY}`, `himring memory-learning scores ${MEMORY} --output json`]
|
|
2581
|
-
},
|
|
2582
|
-
save_memory_question: {
|
|
2583
|
-
resource: "memory-questions",
|
|
2584
|
-
verb: "save",
|
|
2585
|
-
examples: [
|
|
2586
|
-
`himring memory-questions save ${MEMORY} ${STORED} --question "Where do I send returns?"`,
|
|
2587
|
-
`himring memory-questions save ${MEMORY} ${STORED} --question "What is my delivery address?" --end-user customer-1042 --output json`
|
|
2588
|
-
]
|
|
2589
|
-
},
|
|
2590
|
-
list_memory_saved_questions: {
|
|
2591
|
-
resource: "memory-questions",
|
|
2592
|
-
verb: "list",
|
|
2593
|
-
examples: [
|
|
2594
|
-
`himring memory-questions list ${MEMORY}`,
|
|
2595
|
-
`himring memory-questions list ${MEMORY} --flagged true --output json`
|
|
2596
|
-
]
|
|
2597
|
-
},
|
|
2598
|
-
delete_memory_saved_question: {
|
|
2599
|
-
resource: "memory-questions",
|
|
2600
|
-
verb: "delete",
|
|
2601
|
-
confirm: true,
|
|
2602
|
-
examples: [
|
|
2603
|
-
`himring memory-questions delete ${MEMORY} ${SAVED} --yes`,
|
|
2604
|
-
`himring memory-questions delete ${MEMORY} ${SAVED} --dry-run`
|
|
2605
|
-
]
|
|
2606
|
-
}
|
|
2278
|
+
var MEMORY_REVIEW_EXAMPLES = {
|
|
2279
|
+
list_memory_decisions: [
|
|
2280
|
+
`himring memory-decisions list ${MEMORY} --kind disputed,file_conflict`,
|
|
2281
|
+
`himring memory-decisions list ${MEMORY} --subject-owner billing-team --by-person true --output json`
|
|
2282
|
+
],
|
|
2283
|
+
settle_memory: [
|
|
2284
|
+
`himring memory-decisions settle ${MEMORY} ${STORED} --trust-level confirmed --yes`,
|
|
2285
|
+
`himring memory-decisions settle ${MEMORY} ${STORED} --trust-level confirmed --over-file true --dry-run`
|
|
2286
|
+
],
|
|
2287
|
+
forget_memory: [
|
|
2288
|
+
`himring memory-decisions forget ${MEMORY} ${STORED} --yes`,
|
|
2289
|
+
`himring memory-decisions forget ${MEMORY} ${STORED} --dry-run`
|
|
2290
|
+
],
|
|
2291
|
+
recover_memory: [
|
|
2292
|
+
`himring memory-decisions recover ${MEMORY} ${STORED}`,
|
|
2293
|
+
`himring memory-decisions recover ${MEMORY} ${STORED} --output json`
|
|
2294
|
+
],
|
|
2295
|
+
list_forgetting_suggestions: [
|
|
2296
|
+
`himring memory-decisions suggestions ${MEMORY}`,
|
|
2297
|
+
`himring memory-decisions suggestions ${MEMORY} --limit 50 --output json`
|
|
2298
|
+
],
|
|
2299
|
+
send_memory_feedback: [
|
|
2300
|
+
`himring memory-decisions feedback ${MEMORY} ${STORED} --verdict wrong ${RECALL}`,
|
|
2301
|
+
`himring memory-decisions feedback ${MEMORY} ${STORED} --verdict right --output json`
|
|
2302
|
+
],
|
|
2303
|
+
recall_memories: [
|
|
2304
|
+
`himring recall search ${MEMORY} --query "delivery address" --end-user customer-1042`,
|
|
2305
|
+
`himring recall search ${MEMORY} --query "returns window" --as-of 2026-10-01T09:00:00Z --output json`
|
|
2306
|
+
],
|
|
2307
|
+
get_memory_context: [
|
|
2308
|
+
`himring recall context ${MEMORY} --end-user customer-1042`,
|
|
2309
|
+
`himring recall context ${MEMORY} --team support-emea --agent billing-bot --output json`
|
|
2310
|
+
],
|
|
2311
|
+
set_memory_webhook: [
|
|
2312
|
+
`himring memory-webhooks set ${MEMORY} --url https://example.com/himring/events --yes`,
|
|
2313
|
+
`himring memory-webhooks set ${MEMORY} --url https://example.com/himring/events --dry-run`
|
|
2314
|
+
],
|
|
2315
|
+
get_memory_webhook: [`himring memory-webhooks get ${MEMORY}`, `himring memory-webhooks get ${MEMORY} --output json`],
|
|
2316
|
+
remove_memory_webhook: [
|
|
2317
|
+
`himring memory-webhooks remove ${MEMORY} --yes`,
|
|
2318
|
+
`himring memory-webhooks remove ${MEMORY} --dry-run`
|
|
2319
|
+
],
|
|
2320
|
+
list_memory_webhook_deliveries: [
|
|
2321
|
+
`himring memory-webhooks deliveries ${MEMORY} --state waiting,failed`,
|
|
2322
|
+
`himring memory-webhooks deliveries ${MEMORY} --output json`
|
|
2323
|
+
],
|
|
2324
|
+
list_learned_changes: [
|
|
2325
|
+
`himring memory-learning list ${MEMORY}`,
|
|
2326
|
+
`himring memory-learning list ${MEMORY} --output json`
|
|
2327
|
+
],
|
|
2328
|
+
undo_learned_change: [
|
|
2329
|
+
`himring memory-learning undo ${MEMORY} ${CHANGE} --yes`,
|
|
2330
|
+
`himring memory-learning undo ${MEMORY} ${CHANGE} --dry-run`
|
|
2331
|
+
],
|
|
2332
|
+
tune_memory: [`himring memory-learning tune ${MEMORY}`, `himring memory-learning tune ${MEMORY} --output json`],
|
|
2333
|
+
get_memory_scores: [
|
|
2334
|
+
`himring memory-learning scores ${MEMORY}`,
|
|
2335
|
+
`himring memory-learning scores ${MEMORY} --output json`
|
|
2336
|
+
],
|
|
2337
|
+
save_memory_question: [
|
|
2338
|
+
`himring memory-questions save ${MEMORY} ${STORED} --question "Where do I send returns?"`,
|
|
2339
|
+
`himring memory-questions save ${MEMORY} ${STORED} --question "What is my delivery address?" --end-user customer-1042 --output json`
|
|
2340
|
+
],
|
|
2341
|
+
list_memory_saved_questions: [
|
|
2342
|
+
`himring memory-questions list ${MEMORY}`,
|
|
2343
|
+
`himring memory-questions list ${MEMORY} --flagged true --output json`
|
|
2344
|
+
],
|
|
2345
|
+
delete_memory_saved_question: [
|
|
2346
|
+
`himring memory-questions delete ${MEMORY} ${SAVED} --yes`,
|
|
2347
|
+
`himring memory-questions delete ${MEMORY} ${SAVED} --dry-run`
|
|
2348
|
+
]
|
|
2607
2349
|
};
|
|
2608
2350
|
|
|
2609
2351
|
// src/memory-specs.ts
|
|
@@ -2619,185 +2361,87 @@ var MEMORY2 = "--memory mem_3f9a0c1e2d4b6a8c0e2f4a6b8c0d2e4f";
|
|
|
2619
2361
|
var STORED2 = "--stored-memory mm_9b1d3f5a7c9e1b3d5f7a9c1e3b5d7f9a";
|
|
2620
2362
|
var REVIEW = "--review rev_2c4e6a8c0e2a4c6e8a0c2e4a6c8e0a2c";
|
|
2621
2363
|
var SOURCE = "--source src_6d8f0a2c4e1b3d5f7a9c0e2b4d6f8a1c";
|
|
2622
|
-
var
|
|
2623
|
-
enable_memory:
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
create_memory_source: {
|
|
2704
|
-
resource: "memory-sources",
|
|
2705
|
-
verb: "create",
|
|
2706
|
-
examples: [
|
|
2707
|
-
`himring memory-sources create ${MEMORY2} --name "Support agent" --kind agent`,
|
|
2708
|
-
`himring memory-sources create ${MEMORY2} --name "Customers table" --kind database --settings-file table.json --output json`
|
|
2709
|
-
]
|
|
2710
|
-
},
|
|
2711
|
-
list_memory_sources: {
|
|
2712
|
-
resource: "memory-sources",
|
|
2713
|
-
verb: "list",
|
|
2714
|
-
examples: [
|
|
2715
|
-
`himring memory-sources list ${MEMORY2}`,
|
|
2716
|
-
`himring memory-sources list ${MEMORY2} --kind slack --output json`
|
|
2717
|
-
]
|
|
2718
|
-
},
|
|
2719
|
-
get_memory_source: {
|
|
2720
|
-
resource: "memory-sources",
|
|
2721
|
-
verb: "get",
|
|
2722
|
-
examples: [
|
|
2723
|
-
`himring memory-sources get ${MEMORY2} ${SOURCE}`,
|
|
2724
|
-
`himring memory-sources get ${MEMORY2} ${SOURCE} --output json`
|
|
2725
|
-
]
|
|
2726
|
-
},
|
|
2727
|
-
update_memory_source: {
|
|
2728
|
-
resource: "memory-sources",
|
|
2729
|
-
verb: "update",
|
|
2730
|
-
confirm: true,
|
|
2731
|
-
examples: [
|
|
2732
|
-
`himring memory-sources update ${MEMORY2} ${SOURCE} --sorting rules_only --yes`,
|
|
2733
|
-
`himring memory-sources update ${MEMORY2} ${SOURCE} --name "Support agent, Europe" --dry-run`
|
|
2734
|
-
]
|
|
2735
|
-
},
|
|
2736
|
-
delete_memory_source: {
|
|
2737
|
-
resource: "memory-sources",
|
|
2738
|
-
verb: "delete",
|
|
2739
|
-
confirm: true,
|
|
2740
|
-
examples: [
|
|
2741
|
-
`himring memory-sources delete ${MEMORY2} ${SOURCE} --yes`,
|
|
2742
|
-
`himring memory-sources delete ${MEMORY2} ${SOURCE} --dry-run`
|
|
2743
|
-
]
|
|
2744
|
-
},
|
|
2745
|
-
sync_memory_source: {
|
|
2746
|
-
resource: "memory-sources",
|
|
2747
|
-
verb: "sync",
|
|
2748
|
-
examples: [
|
|
2749
|
-
`himring memory-sources sync ${MEMORY2} ${SOURCE}`,
|
|
2750
|
-
`himring memory-sources sync ${MEMORY2} ${SOURCE} --output json`
|
|
2751
|
-
]
|
|
2752
|
-
},
|
|
2753
|
-
start_memory_source_sign_in: {
|
|
2754
|
-
resource: "memory-sources",
|
|
2755
|
-
verb: "sign-in",
|
|
2756
|
-
examples: [
|
|
2757
|
-
`himring memory-sources sign-in ${MEMORY2} ${SOURCE}`,
|
|
2758
|
-
`himring memory-sources sign-in ${MEMORY2} ${SOURCE} --output json`
|
|
2759
|
-
]
|
|
2760
|
-
},
|
|
2761
|
-
add_messages: {
|
|
2762
|
-
resource: "messages",
|
|
2763
|
-
verb: "add",
|
|
2764
|
-
examples: [
|
|
2765
|
-
`himring messages add ${MEMORY2} ${SOURCE} --items-file messages.json`,
|
|
2766
|
-
`cat messages.json | himring messages add ${MEMORY2} ${SOURCE} --items-file - --output json`
|
|
2767
|
-
]
|
|
2768
|
-
},
|
|
2769
|
-
list_messages: {
|
|
2770
|
-
resource: "messages",
|
|
2771
|
-
verb: "list",
|
|
2772
|
-
examples: [
|
|
2773
|
-
`himring messages list ${MEMORY2} --state waiting,failed`,
|
|
2774
|
-
`himring messages list ${MEMORY2} ${SOURCE} --conversation-id ticket-88 --output json`
|
|
2775
|
-
]
|
|
2776
|
-
},
|
|
2777
|
-
get_message: {
|
|
2778
|
-
resource: "messages",
|
|
2779
|
-
verb: "get",
|
|
2780
|
-
examples: [
|
|
2781
|
-
`himring messages get ${MEMORY2} ${SOURCE} --external-id ticket-88-reply-3`,
|
|
2782
|
-
`himring messages get ${MEMORY2} ${SOURCE} --external-id ticket-88-reply-3 --version 2 --output json`
|
|
2783
|
-
]
|
|
2784
|
-
},
|
|
2785
|
-
export_memories: {
|
|
2786
|
-
resource: "memories",
|
|
2787
|
-
verb: "export",
|
|
2788
|
-
examples: [
|
|
2789
|
-
`himring memories export ${MEMORY2} --end-user customer-1042 --out customer-1042-memories.json`,
|
|
2790
|
-
`himring memories export ${MEMORY2} --after mm_9b1d3f5a7c9e1b3d5f7a9c1e3b5d7f9a --out memories-part-2.json --force`
|
|
2791
|
-
]
|
|
2792
|
-
},
|
|
2793
|
-
list_memory_owners: {
|
|
2794
|
-
resource: "memory-owners",
|
|
2795
|
-
verb: "list",
|
|
2796
|
-
examples: [
|
|
2797
|
-
`himring memory-owners list ${MEMORY2} --query support`,
|
|
2798
|
-
`himring memory-owners list ${MEMORY2} --scope team --output json`
|
|
2799
|
-
]
|
|
2800
|
-
}
|
|
2364
|
+
var MEMORY_EXAMPLES = {
|
|
2365
|
+
enable_memory: ["himring memory enable", "himring memory enable --language french --confidence-threshold 0.9"],
|
|
2366
|
+
get_memory: ["himring memory get", "himring memory get --state deleted --output json"],
|
|
2367
|
+
update_memory: [
|
|
2368
|
+
`himring memory update ${MEMORY2} --duplicate-threshold 0.85 --yes`,
|
|
2369
|
+
`himring memory update ${MEMORY2} --knowledge-base-choice listed --checked-knowledge-base-ids kb_4a6c8e0a2c4e6a8c0e2a4c6e8a0c2e4a,kb_7e9a1c3e5a7c9e1a3c5e7a9c1e3a5c7e --dry-run`
|
|
2370
|
+
],
|
|
2371
|
+
delete_memory: [`himring memory delete ${MEMORY2} --yes`, `himring memory delete ${MEMORY2} --dry-run`],
|
|
2372
|
+
restore_memory: [`himring memory restore ${MEMORY2}`, `himring memory restore ${MEMORY2} --output json`],
|
|
2373
|
+
list_memories: [
|
|
2374
|
+
`himring memories list ${MEMORY2} --end-user customer-1042 --query "delivery address"`,
|
|
2375
|
+
`himring memories list ${MEMORY2} --type plan --plan-state open,overdue --output json`
|
|
2376
|
+
],
|
|
2377
|
+
inspect_memory: [
|
|
2378
|
+
`himring memories inspect ${MEMORY2} ${STORED2}`,
|
|
2379
|
+
`himring memories inspect ${MEMORY2} ${STORED2} --output json`
|
|
2380
|
+
],
|
|
2381
|
+
promote_memory: [
|
|
2382
|
+
`himring memories promote ${MEMORY2} ${STORED2} --scope company --yes`,
|
|
2383
|
+
`himring memories promote ${MEMORY2} ${STORED2} --scope team --team support-emea --dry-run`
|
|
2384
|
+
],
|
|
2385
|
+
sort_message: [
|
|
2386
|
+
`himring memories sort ${MEMORY2} --text "Refunds now take 5 working days." --author "Head of support" --author-kind staff`,
|
|
2387
|
+
`himring memories sort ${MEMORY2} --text "I moved to Leeds." --author customer-1042 --author-kind end_user --end-user customer-1042 --output json`
|
|
2388
|
+
],
|
|
2389
|
+
list_memory_reviews: [
|
|
2390
|
+
`himring memory-reviews list ${MEMORY2}`,
|
|
2391
|
+
`himring memory-reviews list ${MEMORY2} --reason instruction_like,disputed --output json`
|
|
2392
|
+
],
|
|
2393
|
+
settle_memory_review: [
|
|
2394
|
+
`himring memory-reviews settle ${MEMORY2} ${REVIEW} --trust-level confirmed --yes`,
|
|
2395
|
+
`himring memory-reviews settle ${MEMORY2} ${REVIEW} --trust-level not_kept --dry-run`
|
|
2396
|
+
],
|
|
2397
|
+
create_memory_source: [
|
|
2398
|
+
`himring memory-sources create ${MEMORY2} --name "Support agent" --kind agent`,
|
|
2399
|
+
`himring memory-sources create ${MEMORY2} --name "Customers table" --kind database --settings-file table.json --output json`
|
|
2400
|
+
],
|
|
2401
|
+
list_memory_sources: [
|
|
2402
|
+
`himring memory-sources list ${MEMORY2}`,
|
|
2403
|
+
`himring memory-sources list ${MEMORY2} --kind slack --output json`
|
|
2404
|
+
],
|
|
2405
|
+
get_memory_source: [
|
|
2406
|
+
`himring memory-sources get ${MEMORY2} ${SOURCE}`,
|
|
2407
|
+
`himring memory-sources get ${MEMORY2} ${SOURCE} --output json`
|
|
2408
|
+
],
|
|
2409
|
+
update_memory_source: [
|
|
2410
|
+
`himring memory-sources update ${MEMORY2} ${SOURCE} --sorting rules_only --yes`,
|
|
2411
|
+
`himring memory-sources update ${MEMORY2} ${SOURCE} --name "Support agent, Europe" --dry-run`
|
|
2412
|
+
],
|
|
2413
|
+
delete_memory_source: [
|
|
2414
|
+
`himring memory-sources delete ${MEMORY2} ${SOURCE} --yes`,
|
|
2415
|
+
`himring memory-sources delete ${MEMORY2} ${SOURCE} --dry-run`
|
|
2416
|
+
],
|
|
2417
|
+
sync_memory_source: [
|
|
2418
|
+
`himring memory-sources sync ${MEMORY2} ${SOURCE}`,
|
|
2419
|
+
`himring memory-sources sync ${MEMORY2} ${SOURCE} --output json`
|
|
2420
|
+
],
|
|
2421
|
+
start_memory_source_sign_in: [
|
|
2422
|
+
`himring memory-sources sign-in ${MEMORY2} ${SOURCE}`,
|
|
2423
|
+
`himring memory-sources sign-in ${MEMORY2} ${SOURCE} --output json`
|
|
2424
|
+
],
|
|
2425
|
+
add_messages: [
|
|
2426
|
+
`himring messages add ${MEMORY2} ${SOURCE} --items-file messages.json`,
|
|
2427
|
+
`cat messages.json | himring messages add ${MEMORY2} ${SOURCE} --items-file - --output json`
|
|
2428
|
+
],
|
|
2429
|
+
list_messages: [
|
|
2430
|
+
`himring messages list ${MEMORY2} --state waiting,failed`,
|
|
2431
|
+
`himring messages list ${MEMORY2} ${SOURCE} --conversation-id ticket-88 --output json`
|
|
2432
|
+
],
|
|
2433
|
+
get_message: [
|
|
2434
|
+
`himring messages get ${MEMORY2} ${SOURCE} --external-id ticket-88-reply-3`,
|
|
2435
|
+
`himring messages get ${MEMORY2} ${SOURCE} --external-id ticket-88-reply-3 --version 2 --output json`
|
|
2436
|
+
],
|
|
2437
|
+
export_memories: [
|
|
2438
|
+
`himring memories export ${MEMORY2} --end-user customer-1042 --out customer-1042-memories.json`,
|
|
2439
|
+
`himring memories export ${MEMORY2} --after mm_9b1d3f5a7c9e1b3d5f7a9c1e3b5d7f9a --out memories-part-2.json --force`
|
|
2440
|
+
],
|
|
2441
|
+
list_memory_owners: [
|
|
2442
|
+
`himring memory-owners list ${MEMORY2} --query support`,
|
|
2443
|
+
`himring memory-owners list ${MEMORY2} --scope team --output json`
|
|
2444
|
+
]
|
|
2801
2445
|
};
|
|
2802
2446
|
|
|
2803
2447
|
// src/question-set-specs.ts
|
|
@@ -2813,146 +2457,73 @@ var SAVED_QUESTION = "--saved-question svq_7c1e3a5b9d2f4e6a8c0b1d3f5a7c9e2b";
|
|
|
2813
2457
|
var SCORECARD = "--scorecard scr_4a6c8e0b2d1f3a5c7e9b0d2f4a6c8e1b";
|
|
2814
2458
|
var CORRECTION = "--correction cor_9e1c3a5b7d0f2e4a6c8b1d3f5e7a9c2b";
|
|
2815
2459
|
var PASS = "--pass pas_5b7d9f1a3c0e2b4d6f8a0c2e4b6d8f1a";
|
|
2816
|
-
var
|
|
2817
|
-
get_question_set: {
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
`himring scorecards results ${KB3} ${SCORECARD} --compare-to scr_1b3d5f7a9c0e2b4d6f8a1c3e5b7d9f0a --output json`,
|
|
2884
|
-
`himring scorecards results ${KB3} ${SCORECARD} --compare-to scr_1b3d5f7a9c0e2b4d6f8a1c3e5b7d9f0a --change now_passes,now_fails`
|
|
2885
|
-
]
|
|
2886
|
-
},
|
|
2887
|
-
propose_corrections: {
|
|
2888
|
-
resource: "corrections",
|
|
2889
|
-
verb: "propose",
|
|
2890
|
-
examples: [`himring corrections propose ${KB3}`, `himring corrections propose ${KB3} --output json`]
|
|
2891
|
-
},
|
|
2892
|
-
create_correction: {
|
|
2893
|
-
resource: "corrections",
|
|
2894
|
-
verb: "create",
|
|
2895
|
-
examples: [
|
|
2896
|
-
`himring corrections create ${KB3} --setting-file setting.json`,
|
|
2897
|
-
`echo '{"kind":"chunking","chunk_tokens":300}' | himring corrections create ${KB3} --setting-file - --target-ids svq_7c1e3a5b9d2f4e6a8c0b1d3f5a7c9e2b`
|
|
2898
|
-
]
|
|
2899
|
-
},
|
|
2900
|
-
list_corrections: {
|
|
2901
|
-
resource: "corrections",
|
|
2902
|
-
verb: "list",
|
|
2903
|
-
examples: [
|
|
2904
|
-
`himring corrections list ${KB3} ${PASS}`,
|
|
2905
|
-
`himring corrections list ${KB3} --status proposed,tried`,
|
|
2906
|
-
`himring corrections list ${KB3} --kind chunking --output json`
|
|
2907
|
-
]
|
|
2908
|
-
},
|
|
2909
|
-
get_correction: {
|
|
2910
|
-
resource: "corrections",
|
|
2911
|
-
verb: "get",
|
|
2912
|
-
examples: [
|
|
2913
|
-
`himring corrections get ${KB3} ${CORRECTION}`,
|
|
2914
|
-
`himring corrections get ${KB3} ${CORRECTION} --output json`
|
|
2915
|
-
]
|
|
2916
|
-
},
|
|
2917
|
-
try_corrections: {
|
|
2918
|
-
resource: "corrections",
|
|
2919
|
-
verb: "try",
|
|
2920
|
-
examples: [
|
|
2921
|
-
`himring corrections try ${KB3} --correction-ids cor_9e1c3a5b7d0f2e4a6c8b1d3f5e7a9c2b`,
|
|
2922
|
-
`himring corrections try ${KB3} --correction-ids cor_9e1c3a5b7d0f2e4a6c8b1d3f5e7a9c2b --complete-index true`
|
|
2923
|
-
]
|
|
2924
|
-
},
|
|
2925
|
-
promote_correction: {
|
|
2926
|
-
resource: "corrections",
|
|
2927
|
-
verb: "promote",
|
|
2928
|
-
confirm: true,
|
|
2929
|
-
examples: [
|
|
2930
|
-
`himring corrections promote ${KB3} ${CORRECTION} --yes`,
|
|
2931
|
-
`himring corrections promote ${KB3} ${CORRECTION} --note "Held-back score held at 41 of 50" --yes`
|
|
2932
|
-
]
|
|
2933
|
-
},
|
|
2934
|
-
discard_correction: {
|
|
2935
|
-
resource: "corrections",
|
|
2936
|
-
verb: "discard",
|
|
2937
|
-
confirm: true,
|
|
2938
|
-
examples: [
|
|
2939
|
-
`himring corrections discard ${KB3} ${CORRECTION} --yes`,
|
|
2940
|
-
`himring corrections discard ${KB3} ${CORRECTION} --note "Too slow to build" --dry-run`
|
|
2941
|
-
]
|
|
2942
|
-
},
|
|
2943
|
-
list_correction_passes: {
|
|
2944
|
-
resource: "correction-passes",
|
|
2945
|
-
verb: "list",
|
|
2946
|
-
examples: [`himring correction-passes list ${KB3}`, `himring correction-passes list ${KB3} --limit 5 --output json`]
|
|
2947
|
-
},
|
|
2948
|
-
get_correction_pass: {
|
|
2949
|
-
resource: "correction-passes",
|
|
2950
|
-
verb: "get",
|
|
2951
|
-
examples: [
|
|
2952
|
-
`himring correction-passes get ${KB3} ${PASS}`,
|
|
2953
|
-
`himring correction-passes get ${KB3} ${PASS} --output json`
|
|
2954
|
-
]
|
|
2955
|
-
}
|
|
2460
|
+
var QUESTION_SET_EXAMPLES = {
|
|
2461
|
+
get_question_set: [`himring question-set get ${KB3}`, `himring question-set get ${KB3} --output json`],
|
|
2462
|
+
save_question: [
|
|
2463
|
+
`himring saved-questions save ${KB3} --question "How long do refunds take?" --chunk chk_2b4d6f8a0c1e3a5c7e9b8d6f4a2c0e1b`,
|
|
2464
|
+
`himring saved-questions save ${KB3} --question "Where do I sign for repairs?" --file fil_0a1b2c3d4e5f60718293a4b5c6d7e8f9 --first-position 12 --last-position 14`
|
|
2465
|
+
],
|
|
2466
|
+
list_saved_questions: [
|
|
2467
|
+
`himring saved-questions list ${KB3} --state broken`,
|
|
2468
|
+
`himring saved-questions list ${KB3} --split held_back --search refund --output json`
|
|
2469
|
+
],
|
|
2470
|
+
get_saved_question: [
|
|
2471
|
+
`himring saved-questions get ${KB3} ${SAVED_QUESTION}`,
|
|
2472
|
+
`himring saved-questions get ${KB3} ${SAVED_QUESTION} --output json`
|
|
2473
|
+
],
|
|
2474
|
+
update_saved_question: [
|
|
2475
|
+
`himring saved-questions update ${KB3} ${SAVED_QUESTION} --confirm true`,
|
|
2476
|
+
`himring saved-questions update ${KB3} ${SAVED_QUESTION} --file fil_0a1b2c3d4e5f60718293a4b5c6d7e8f9 --first-position 20 --last-position 22`
|
|
2477
|
+
],
|
|
2478
|
+
delete_saved_question: [
|
|
2479
|
+
`himring saved-questions delete ${KB3} ${SAVED_QUESTION} --yes`,
|
|
2480
|
+
`himring saved-questions delete ${KB3} ${SAVED_QUESTION} --dry-run`
|
|
2481
|
+
],
|
|
2482
|
+
score_question_set: [`himring scorecards score ${KB3}`, `himring scorecards score ${KB3} --output json`],
|
|
2483
|
+
list_scorecards: [`himring scorecards list ${KB3}`, `himring scorecards list ${KB3} --limit 5 --output json`],
|
|
2484
|
+
get_scorecard: [
|
|
2485
|
+
`himring scorecards get ${KB3} ${SCORECARD}`,
|
|
2486
|
+
`himring scorecards get ${KB3} ${SCORECARD} --output json`
|
|
2487
|
+
],
|
|
2488
|
+
list_scorecard_results: [
|
|
2489
|
+
`himring scorecards results ${KB3} ${SCORECARD} --outcome failed --cause ranked_lower`,
|
|
2490
|
+
`himring scorecards results ${KB3} ${SCORECARD} --compare-to scr_1b3d5f7a9c0e2b4d6f8a1c3e5b7d9f0a --output json`,
|
|
2491
|
+
`himring scorecards results ${KB3} ${SCORECARD} --compare-to scr_1b3d5f7a9c0e2b4d6f8a1c3e5b7d9f0a --change now_passes,now_fails`
|
|
2492
|
+
],
|
|
2493
|
+
propose_corrections: [`himring corrections propose ${KB3}`, `himring corrections propose ${KB3} --output json`],
|
|
2494
|
+
create_correction: [
|
|
2495
|
+
`himring corrections create ${KB3} --setting-file setting.json`,
|
|
2496
|
+
`echo '{"kind":"chunking","chunk_tokens":300}' | himring corrections create ${KB3} --setting-file - --target-ids svq_7c1e3a5b9d2f4e6a8c0b1d3f5a7c9e2b`
|
|
2497
|
+
],
|
|
2498
|
+
list_corrections: [
|
|
2499
|
+
`himring corrections list ${KB3} ${PASS}`,
|
|
2500
|
+
`himring corrections list ${KB3} --status proposed,tried`,
|
|
2501
|
+
`himring corrections list ${KB3} --kind chunking --output json`
|
|
2502
|
+
],
|
|
2503
|
+
get_correction: [
|
|
2504
|
+
`himring corrections get ${KB3} ${CORRECTION}`,
|
|
2505
|
+
`himring corrections get ${KB3} ${CORRECTION} --output json`
|
|
2506
|
+
],
|
|
2507
|
+
try_corrections: [
|
|
2508
|
+
`himring corrections try ${KB3} --correction-ids cor_9e1c3a5b7d0f2e4a6c8b1d3f5e7a9c2b`,
|
|
2509
|
+
`himring corrections try ${KB3} --correction-ids cor_9e1c3a5b7d0f2e4a6c8b1d3f5e7a9c2b --complete-index true`
|
|
2510
|
+
],
|
|
2511
|
+
promote_correction: [
|
|
2512
|
+
`himring corrections promote ${KB3} ${CORRECTION} --yes`,
|
|
2513
|
+
`himring corrections promote ${KB3} ${CORRECTION} --note "Held-back score held at 41 of 50" --yes`
|
|
2514
|
+
],
|
|
2515
|
+
discard_correction: [
|
|
2516
|
+
`himring corrections discard ${KB3} ${CORRECTION} --yes`,
|
|
2517
|
+
`himring corrections discard ${KB3} ${CORRECTION} --note "Too slow to build" --dry-run`
|
|
2518
|
+
],
|
|
2519
|
+
list_correction_passes: [
|
|
2520
|
+
`himring correction-passes list ${KB3}`,
|
|
2521
|
+
`himring correction-passes list ${KB3} --limit 5 --output json`
|
|
2522
|
+
],
|
|
2523
|
+
get_correction_pass: [
|
|
2524
|
+
`himring correction-passes get ${KB3} ${PASS}`,
|
|
2525
|
+
`himring correction-passes get ${KB3} ${PASS} --output json`
|
|
2526
|
+
]
|
|
2956
2527
|
};
|
|
2957
2528
|
|
|
2958
2529
|
// src/source-specs.ts
|
|
@@ -2963,85 +2534,46 @@ var SOURCE_RESOURCE_DESCRIPTIONS = {
|
|
|
2963
2534
|
};
|
|
2964
2535
|
var KB4 = "--knowledge-base kb_3f9a0c1e2d4b6a8c0e2f4a6b8c0d2e4f";
|
|
2965
2536
|
var SOURCE2 = "--source src_6d8f0a2c4e1b3d5f7a9c0e2b4d6f8a1c";
|
|
2966
|
-
var
|
|
2967
|
-
create_source:
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
`himring sources update ${KB4} ${SOURCE2} --rotate-webhook-secret true --yes --output json`,
|
|
3001
|
-
`himring sources update ${KB4} ${SOURCE2} --name "Support calls, Europe" --dry-run`
|
|
3002
|
-
]
|
|
3003
|
-
},
|
|
3004
|
-
delete_source: {
|
|
3005
|
-
resource: "sources",
|
|
3006
|
-
verb: "delete",
|
|
3007
|
-
confirm: true,
|
|
3008
|
-
examples: [`himring sources delete ${KB4} ${SOURCE2} --yes`, `himring sources delete ${KB4} ${SOURCE2} --dry-run`]
|
|
3009
|
-
},
|
|
3010
|
-
sync_source: {
|
|
3011
|
-
resource: "sources",
|
|
3012
|
-
verb: "sync",
|
|
3013
|
-
examples: [`himring sources sync ${KB4} ${SOURCE2}`, `himring sources sync ${KB4} ${SOURCE2} --output json`]
|
|
3014
|
-
},
|
|
3015
|
-
start_source_sign_in: {
|
|
3016
|
-
resource: "sources",
|
|
3017
|
-
verb: "sign-in",
|
|
3018
|
-
examples: [`himring sources sign-in ${KB4} ${SOURCE2}`, `himring sources sign-in ${KB4} ${SOURCE2} --output json`]
|
|
3019
|
-
},
|
|
3020
|
-
finish_source_sign_in: {
|
|
3021
|
-
resource: "source-sign-ins",
|
|
3022
|
-
verb: "finish",
|
|
3023
|
-
examples: ["himring source-sign-ins finish --state 4kQ9xT2mW7pL0vB3nR8sY1dF6hJ5gK2cZ9aE4uI7oP0 --code 7a1f0c9e2b"]
|
|
3024
|
-
},
|
|
3025
|
-
ingest_items: {
|
|
3026
|
-
resource: "source-items",
|
|
3027
|
-
verb: "ingest",
|
|
3028
|
-
examples: [
|
|
3029
|
-
`himring source-items ingest ${KB4} ${SOURCE2} --items-file items.json`,
|
|
3030
|
-
`cat items.json | himring source-items ingest ${KB4} ${SOURCE2} --items-file - --output json`
|
|
3031
|
-
]
|
|
3032
|
-
},
|
|
3033
|
-
list_source_items: {
|
|
3034
|
-
resource: "source-items",
|
|
3035
|
-
verb: "list",
|
|
3036
|
-
examples: [
|
|
3037
|
-
`himring source-items list ${KB4} ${SOURCE2} --state waiting`,
|
|
3038
|
-
`himring source-items list ${KB4} ${SOURCE2} --external-id order-1042 --output json`
|
|
3039
|
-
]
|
|
3040
|
-
}
|
|
2537
|
+
var SOURCE_EXAMPLES = {
|
|
2538
|
+
create_source: [
|
|
2539
|
+
`himring sources create ${KB4} --name "Order system" --kind push`,
|
|
2540
|
+
`himring sources create ${KB4} --name "Support calls" --kind retell --credentials-file retell.json`,
|
|
2541
|
+
`himring sources create ${KB4} --name "Contracts bucket" --kind s3 --settings-file bucket.json --credentials-file bucket-key.json --output json`
|
|
2542
|
+
],
|
|
2543
|
+
list_sources: [`himring sources list ${KB4}`, `himring sources list ${KB4} --kind vapi,retell --output json`],
|
|
2544
|
+
get_source: [`himring sources get ${KB4} ${SOURCE2}`, `himring sources get ${KB4} ${SOURCE2} --output json`],
|
|
2545
|
+
list_source_syncs: [
|
|
2546
|
+
`himring sources syncs ${KB4} ${SOURCE2}`,
|
|
2547
|
+
`himring sources syncs ${KB4} ${SOURCE2} --limit 5 --output json`
|
|
2548
|
+
],
|
|
2549
|
+
update_source: [
|
|
2550
|
+
`himring sources update ${KB4} ${SOURCE2} --credentials-file new-key.json --yes`,
|
|
2551
|
+
`himring sources update ${KB4} ${SOURCE2} --rotate-webhook-secret true --yes --output json`,
|
|
2552
|
+
`himring sources update ${KB4} ${SOURCE2} --name "Support calls, Europe" --dry-run`
|
|
2553
|
+
],
|
|
2554
|
+
delete_source: [`himring sources delete ${KB4} ${SOURCE2} --yes`, `himring sources delete ${KB4} ${SOURCE2} --dry-run`],
|
|
2555
|
+
sync_source: [`himring sources sync ${KB4} ${SOURCE2}`, `himring sources sync ${KB4} ${SOURCE2} --output json`],
|
|
2556
|
+
start_source_sign_in: [
|
|
2557
|
+
`himring sources sign-in ${KB4} ${SOURCE2}`,
|
|
2558
|
+
`himring sources sign-in ${KB4} ${SOURCE2} --output json`
|
|
2559
|
+
],
|
|
2560
|
+
finish_source_sign_in: [
|
|
2561
|
+
"himring source-sign-ins finish --state 4kQ9xT2mW7pL0vB3nR8sY1dF6hJ5gK2cZ9aE4uI7oP0 --code 7a1f0c9e2b"
|
|
2562
|
+
],
|
|
2563
|
+
ingest_items: [
|
|
2564
|
+
`himring source-items ingest ${KB4} ${SOURCE2} --items-file items.json`,
|
|
2565
|
+
`cat items.json | himring source-items ingest ${KB4} ${SOURCE2} --items-file - --output json`
|
|
2566
|
+
],
|
|
2567
|
+
list_source_items: [
|
|
2568
|
+
`himring source-items list ${KB4} ${SOURCE2} --state waiting`,
|
|
2569
|
+
`himring source-items list ${KB4} ${SOURCE2} --external-id order-1042 --output json`
|
|
2570
|
+
]
|
|
3041
2571
|
};
|
|
3042
2572
|
|
|
3043
2573
|
// src/operation-specs.ts
|
|
3044
2574
|
var RESOURCE_DESCRIPTIONS = {
|
|
2575
|
+
devices: "Issue device credentials and manage access to synced resources.",
|
|
2576
|
+
uploads: "Manage multipart uploads and get signed URLs for their parts.",
|
|
3045
2577
|
operations: "List the operations of the Himring API.",
|
|
3046
2578
|
auth: "Sign up, sign in, set up your second factor, and sign out.",
|
|
3047
2579
|
projects: "Create, read, delete, and restore projects.",
|
|
@@ -3066,253 +2598,130 @@ var INVITATION = "--invitation inv_5e7d9c1b3a2f4e6d8c0b1a9f7e5d3c2b";
|
|
|
3066
2598
|
var KEY = "--key key_2b4d6f8a0c1e3a5c7e9b8d6f4a2c0e1b";
|
|
3067
2599
|
var DATABASE = "--database db_3a9e5c7b1d2f4e6a8c0b9d7f5e3a1c2b";
|
|
3068
2600
|
var INDEX2 = "--index ix_8c4b2a0f1e3d5c7b9a8f6e4d2c0b1a3f";
|
|
3069
|
-
var
|
|
3070
|
-
list_operations:
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
},
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
`printf '%s' '{"access":"restricted","indexes":{"level":"read"}}' | himring api-keys update ${KEY} --permissions-file -`,
|
|
3169
|
-
`himring api-keys update ${KEY} --permissions-file read-only.json --output json`
|
|
3170
|
-
]
|
|
3171
|
-
},
|
|
3172
|
-
list_api_key_permission_changes: {
|
|
3173
|
-
resource: "api-keys",
|
|
3174
|
-
verb: "permission-changes",
|
|
3175
|
-
examples: [
|
|
3176
|
-
`himring api-keys permission-changes ${KEY}`,
|
|
3177
|
-
`himring api-keys permission-changes ${KEY} --limit 10 --output json`
|
|
3178
|
-
]
|
|
3179
|
-
},
|
|
3180
|
-
list_api_keys: {
|
|
3181
|
-
resource: "api-keys",
|
|
3182
|
-
verb: "list",
|
|
3183
|
-
examples: [
|
|
3184
|
-
`himring api-keys list ${PROJECT} --status active`,
|
|
3185
|
-
"himring api-keys list --search hmr_3f9a --created-from 2026-10-01 --output json"
|
|
3186
|
-
]
|
|
3187
|
-
},
|
|
3188
|
-
revoke_api_key: {
|
|
3189
|
-
resource: "api-keys",
|
|
3190
|
-
verb: "revoke",
|
|
3191
|
-
confirm: true,
|
|
3192
|
-
examples: [`himring api-keys revoke ${KEY} --yes`, `himring api-keys revoke ${KEY} --dry-run`]
|
|
3193
|
-
},
|
|
3194
|
-
create_database: {
|
|
3195
|
-
resource: "databases",
|
|
3196
|
-
verb: "create",
|
|
3197
|
-
examples: [
|
|
3198
|
-
"himring databases create --name orders",
|
|
3199
|
-
"himring databases create --name orders --migrations-file migrations.json"
|
|
3200
|
-
]
|
|
3201
|
-
},
|
|
3202
|
-
list_databases: {
|
|
3203
|
-
resource: "databases",
|
|
3204
|
-
verb: "list",
|
|
3205
|
-
examples: [
|
|
3206
|
-
"himring databases list --search orders --creator key --sort name --direction asc",
|
|
3207
|
-
"himring databases list --state deleted --sort purge_after --direction asc --limit 20 --offset 20 --output json"
|
|
3208
|
-
]
|
|
3209
|
-
},
|
|
3210
|
-
get_database: {
|
|
3211
|
-
resource: "databases",
|
|
3212
|
-
verb: "get",
|
|
3213
|
-
examples: [`himring databases get ${DATABASE}`, `himring databases get ${DATABASE} --output json`]
|
|
3214
|
-
},
|
|
3215
|
-
update_database: {
|
|
3216
|
-
resource: "databases",
|
|
3217
|
-
verb: "update",
|
|
3218
|
-
confirm: true,
|
|
3219
|
-
examples: [
|
|
3220
|
-
`himring databases update ${DATABASE} --sql-write-preview true --yes`,
|
|
3221
|
-
`himring databases update ${DATABASE} --sql-write-preview false --dry-run`
|
|
3222
|
-
]
|
|
3223
|
-
},
|
|
3224
|
-
delete_database: {
|
|
3225
|
-
resource: "databases",
|
|
3226
|
-
verb: "delete",
|
|
3227
|
-
confirm: true,
|
|
3228
|
-
examples: [`himring databases delete ${DATABASE} --yes`, `himring databases delete ${DATABASE} --dry-run`]
|
|
3229
|
-
},
|
|
3230
|
-
restore_database: {
|
|
3231
|
-
resource: "databases",
|
|
3232
|
-
verb: "restore",
|
|
3233
|
-
examples: [`himring databases restore ${DATABASE}`, `himring databases restore ${DATABASE} --output json`]
|
|
3234
|
-
},
|
|
3235
|
-
compact_database: {
|
|
3236
|
-
resource: "databases",
|
|
3237
|
-
verb: "compact",
|
|
3238
|
-
examples: [`himring databases compact ${DATABASE}`, `himring databases compact ${DATABASE} --output json`]
|
|
3239
|
-
},
|
|
3240
|
-
list_database_migrations: {
|
|
3241
|
-
resource: "migrations",
|
|
3242
|
-
verb: "list",
|
|
3243
|
-
examples: [`himring migrations list ${DATABASE}`, `himring migrations list ${DATABASE} --output json`]
|
|
3244
|
-
},
|
|
3245
|
-
add_database_migration: {
|
|
3246
|
-
resource: "migrations",
|
|
3247
|
-
verb: "add",
|
|
3248
|
-
examples: [
|
|
3249
|
-
`himring migrations add ${DATABASE} --name add_orders --sql-file 002_add_orders.sql`,
|
|
3250
|
-
`echo 'CREATE INDEX orders_by_day ON orders (day);' | himring migrations add ${DATABASE} --name orders_by_day --sql-file -`
|
|
3251
|
-
]
|
|
3252
|
-
},
|
|
3253
|
-
create_index: {
|
|
3254
|
-
resource: "indexes",
|
|
3255
|
-
verb: "create",
|
|
3256
|
-
examples: [
|
|
3257
|
-
"himring indexes create --name articles --config-file articles.json",
|
|
3258
|
-
"cat articles.json | himring indexes create --name articles --config-file -"
|
|
3259
|
-
]
|
|
3260
|
-
},
|
|
3261
|
-
list_indexes: {
|
|
3262
|
-
resource: "indexes",
|
|
3263
|
-
verb: "list",
|
|
3264
|
-
examples: [
|
|
3265
|
-
"himring indexes list --search articles --created-from 2026-10-01 --created-to 2026-10-31",
|
|
3266
|
-
"himring indexes list --state deleted --sort purge_after --direction asc --output json"
|
|
3267
|
-
]
|
|
3268
|
-
},
|
|
3269
|
-
get_index: {
|
|
3270
|
-
resource: "indexes",
|
|
3271
|
-
verb: "get",
|
|
3272
|
-
examples: [`himring indexes get ${INDEX2}`, `himring indexes get ${INDEX2} --output json`]
|
|
3273
|
-
},
|
|
3274
|
-
delete_index: {
|
|
3275
|
-
resource: "indexes",
|
|
3276
|
-
verb: "delete",
|
|
3277
|
-
confirm: true,
|
|
3278
|
-
examples: [`himring indexes delete ${INDEX2} --yes`, `himring indexes delete ${INDEX2} --dry-run`]
|
|
3279
|
-
},
|
|
3280
|
-
restore_index: {
|
|
3281
|
-
resource: "indexes",
|
|
3282
|
-
verb: "restore",
|
|
3283
|
-
examples: [`himring indexes restore ${INDEX2}`, `himring indexes restore ${INDEX2} --output json`]
|
|
3284
|
-
},
|
|
3285
|
-
download_index: {
|
|
3286
|
-
resource: "indexes",
|
|
3287
|
-
verb: "download",
|
|
3288
|
-
examples: [`himring indexes download ${INDEX2}`, `himring indexes download ${INDEX2} --out backup.nrsl --force`]
|
|
3289
|
-
},
|
|
3290
|
-
...DATABASE_WORKSPACE_COMMANDS,
|
|
3291
|
-
...INDEX_RECORD_COMMANDS,
|
|
3292
|
-
...KNOWLEDGE_BASE_COMMANDS,
|
|
3293
|
-
...QUESTION_SET_COMMANDS,
|
|
3294
|
-
...FLAGGED_QUESTION_COMMANDS,
|
|
3295
|
-
...SOURCE_COMMANDS,
|
|
3296
|
-
...MEMORY_COMMANDS,
|
|
3297
|
-
...MEMORY_REVIEW_COMMANDS
|
|
2601
|
+
var OPERATION_EXAMPLES = {
|
|
2602
|
+
list_operations: ["himring operations list", "himring operations list --output json"],
|
|
2603
|
+
get_session: ["himring auth session", "himring auth session --output json"],
|
|
2604
|
+
create_project: [
|
|
2605
|
+
'himring projects create --name "Support answers"',
|
|
2606
|
+
"himring projects create --name Docs --output json"
|
|
2607
|
+
],
|
|
2608
|
+
list_projects: [
|
|
2609
|
+
"himring projects list --search support --role owner",
|
|
2610
|
+
"himring projects list --state deleted --sort purge_after --direction asc --output json"
|
|
2611
|
+
],
|
|
2612
|
+
get_project: [
|
|
2613
|
+
`himring projects get ${PROJECT}`,
|
|
2614
|
+
"HIMRING_PROJECT=prj_6d2f0c1e9a8b4c7d5e3f2a1b0c9d8e7f himring projects get"
|
|
2615
|
+
],
|
|
2616
|
+
delete_project: [`himring projects delete ${PROJECT} --yes`, `himring projects delete ${PROJECT} --dry-run`],
|
|
2617
|
+
restore_project: [`himring projects restore ${PROJECT}`, `himring projects restore ${PROJECT} --output json`],
|
|
2618
|
+
list_members: [
|
|
2619
|
+
`himring members list ${PROJECT} --role owner`,
|
|
2620
|
+
"himring members list --search example.com --sort added_at --direction desc --limit 20 --output json"
|
|
2621
|
+
],
|
|
2622
|
+
remove_member: [`himring members remove ${PROJECT} ${ACCOUNT} --yes`, `himring members remove ${ACCOUNT} --dry-run`],
|
|
2623
|
+
invite_member: [
|
|
2624
|
+
"himring invitations create --email teammate@example.com",
|
|
2625
|
+
"himring invitations create --email second-owner@example.com --role owner"
|
|
2626
|
+
],
|
|
2627
|
+
list_invitations: [
|
|
2628
|
+
`himring invitations list ${PROJECT} --status expired`,
|
|
2629
|
+
"himring invitations list --role member --sort expires_at --direction asc --output json"
|
|
2630
|
+
],
|
|
2631
|
+
revoke_invitation: [
|
|
2632
|
+
`himring invitations revoke ${INVITATION} --yes`,
|
|
2633
|
+
`himring invitations revoke ${INVITATION} --dry-run`
|
|
2634
|
+
],
|
|
2635
|
+
accept_invitation: [
|
|
2636
|
+
"himring invitations accept --token-file invitation.txt",
|
|
2637
|
+
'printf "%s" "$INVITATION_TOKEN" | himring invitations accept --token-file - --output json'
|
|
2638
|
+
],
|
|
2639
|
+
create_api_key: [
|
|
2640
|
+
`printf '%s' '{"access":"full"}' | himring api-keys create --name CI --permissions-file -`,
|
|
2641
|
+
'himring api-keys create --name "Support agent" --permissions-file support-agent-permissions.json --output json'
|
|
2642
|
+
],
|
|
2643
|
+
update_api_key: [
|
|
2644
|
+
`printf '%s' '{"access":"restricted","indexes":{"level":"read"}}' | himring api-keys update ${KEY} --permissions-file -`,
|
|
2645
|
+
`himring api-keys update ${KEY} --permissions-file read-only.json --output json`
|
|
2646
|
+
],
|
|
2647
|
+
list_api_key_permission_changes: [
|
|
2648
|
+
`himring api-keys permission-changes ${KEY}`,
|
|
2649
|
+
`himring api-keys permission-changes ${KEY} --limit 10 --output json`
|
|
2650
|
+
],
|
|
2651
|
+
list_api_keys: [
|
|
2652
|
+
`himring api-keys list ${PROJECT} --status active`,
|
|
2653
|
+
"himring api-keys list --search hmr_3f9a --created-from 2026-10-01 --output json"
|
|
2654
|
+
],
|
|
2655
|
+
revoke_api_key: [`himring api-keys revoke ${KEY} --yes`, `himring api-keys revoke ${KEY} --dry-run`],
|
|
2656
|
+
create_database: [
|
|
2657
|
+
"himring databases create --name orders",
|
|
2658
|
+
"himring databases create --name orders --migrations-file migrations.json"
|
|
2659
|
+
],
|
|
2660
|
+
list_databases: [
|
|
2661
|
+
"himring databases list --search orders --creator key --sort name --direction asc",
|
|
2662
|
+
"himring databases list --state deleted --sort purge_after --direction asc --limit 20 --offset 20 --output json"
|
|
2663
|
+
],
|
|
2664
|
+
get_database: [`himring databases get ${DATABASE}`, `himring databases get ${DATABASE} --output json`],
|
|
2665
|
+
update_database: [
|
|
2666
|
+
`himring databases update ${DATABASE} --sql-write-preview true --yes`,
|
|
2667
|
+
`himring databases update ${DATABASE} --sql-write-preview false --dry-run`
|
|
2668
|
+
],
|
|
2669
|
+
delete_database: [`himring databases delete ${DATABASE} --yes`, `himring databases delete ${DATABASE} --dry-run`],
|
|
2670
|
+
restore_database: [`himring databases restore ${DATABASE}`, `himring databases restore ${DATABASE} --output json`],
|
|
2671
|
+
compact_database: [`himring databases compact ${DATABASE}`, `himring databases compact ${DATABASE} --output json`],
|
|
2672
|
+
list_database_migrations: [
|
|
2673
|
+
`himring migrations list ${DATABASE}`,
|
|
2674
|
+
`himring migrations list ${DATABASE} --output json`
|
|
2675
|
+
],
|
|
2676
|
+
add_database_migration: [
|
|
2677
|
+
`himring migrations add ${DATABASE} --name add_orders --sql-file 002_add_orders.sql`,
|
|
2678
|
+
`echo 'CREATE INDEX orders_by_day ON orders (day);' | himring migrations add ${DATABASE} --name orders_by_day --sql-file -`
|
|
2679
|
+
],
|
|
2680
|
+
create_index: [
|
|
2681
|
+
"himring indexes create --name articles --config-file articles.json",
|
|
2682
|
+
"cat articles.json | himring indexes create --name articles --config-file -"
|
|
2683
|
+
],
|
|
2684
|
+
list_indexes: [
|
|
2685
|
+
"himring indexes list --search articles --created-from 2026-10-01 --created-to 2026-10-31",
|
|
2686
|
+
"himring indexes list --state deleted --sort purge_after --direction asc --output json"
|
|
2687
|
+
],
|
|
2688
|
+
get_index: [`himring indexes get ${INDEX2}`, `himring indexes get ${INDEX2} --output json`],
|
|
2689
|
+
delete_index: [`himring indexes delete ${INDEX2} --yes`, `himring indexes delete ${INDEX2} --dry-run`],
|
|
2690
|
+
restore_index: [`himring indexes restore ${INDEX2}`, `himring indexes restore ${INDEX2} --output json`],
|
|
2691
|
+
download_index: [`himring indexes download ${INDEX2}`, `himring indexes download ${INDEX2} --out backup.nrsl --force`],
|
|
2692
|
+
...DATABASE_WORKSPACE_EXAMPLES,
|
|
2693
|
+
...INDEX_RECORD_EXAMPLES,
|
|
2694
|
+
...KNOWLEDGE_BASE_EXAMPLES,
|
|
2695
|
+
...QUESTION_SET_EXAMPLES,
|
|
2696
|
+
...FLAGGED_QUESTION_EXAMPLES,
|
|
2697
|
+
...SOURCE_EXAMPLES,
|
|
2698
|
+
...MEMORY_EXAMPLES,
|
|
2699
|
+
...MEMORY_REVIEW_EXAMPLES
|
|
3298
2700
|
};
|
|
3299
2701
|
|
|
3300
2702
|
// src/operation-commands.ts
|
|
3301
2703
|
var INPUT_SUGGESTION2 = "Correct the options and try again.";
|
|
3302
|
-
function isCommandOperation(id) {
|
|
3303
|
-
return Object.hasOwn(OPERATION_COMMANDS, id) && Object.hasOwn(HIMRING_OPERATIONS3, id);
|
|
3304
|
-
}
|
|
3305
2704
|
async function runOperation(context, id, spec, fields, options) {
|
|
3306
2705
|
return runCommand(context, async () => {
|
|
3307
2706
|
const input = await inputFrom(context, fields, options);
|
|
3308
2707
|
checkInput(id, input, INPUT_SUGGESTION2);
|
|
3309
|
-
if (
|
|
3310
|
-
if (spec.confirm === true && options.yes !== true) {
|
|
2708
|
+
if (spec.confirm === true && options.yes !== true && options.dryRun !== true) {
|
|
3311
2709
|
throw new UsageError(
|
|
3312
2710
|
`${HIMRING_OPERATION_CATALOGUE5[id].summary} The command needs your confirmation.`,
|
|
3313
2711
|
"Pass --yes to go ahead."
|
|
3314
2712
|
);
|
|
3315
2713
|
}
|
|
2714
|
+
if (HIMRING_OPERATIONS3[id].body === "file") {
|
|
2715
|
+
return sendFileBody(context, {
|
|
2716
|
+
id,
|
|
2717
|
+
input,
|
|
2718
|
+
from: typeof options.from === "string" ? options.from : void 0,
|
|
2719
|
+
dryRun: options.dryRun === true,
|
|
2720
|
+
suggestion: INPUT_SUGGESTION2,
|
|
2721
|
+
splitHint: "Choose a file within the documented limit."
|
|
2722
|
+
});
|
|
2723
|
+
}
|
|
2724
|
+
if (options.dryRun === true) return dryRunOf(id, input, withoutPathFields(id, input));
|
|
3316
2725
|
const result = await (await signedInClient(context)).invoke(id, input);
|
|
3317
2726
|
if (HIMRING_OPERATIONS3[id].response.kind === "download") {
|
|
3318
2727
|
return saveDownloadTo(result, {
|
|
@@ -3341,6 +2750,8 @@ function addOperationCommand(group, id, spec, contextFor, recordExitCode) {
|
|
|
3341
2750
|
const fields = fieldOptionsOf(id);
|
|
3342
2751
|
const command = group.command(spec.verb).description(entry.summary).addHelpText("after", examplesText(spec));
|
|
3343
2752
|
addFieldOptions(command, fields);
|
|
2753
|
+
if (HIMRING_OPERATIONS3[id].body === "file")
|
|
2754
|
+
command.requiredOption("--from <path>", "read the request body from a file");
|
|
3344
2755
|
command.option("--input-file <path>", "read the whole input as one JSON object from a file, or - for stdin");
|
|
3345
2756
|
if (entry.changesState) command.option("--dry-run", "check the input and show the request, without sending it");
|
|
3346
2757
|
if (spec.confirm === true) command.option("--yes", "confirm the change that the command makes");
|
|
@@ -3360,8 +2771,13 @@ function addOperationCommand(group, id, spec, contextFor, recordExitCode) {
|
|
|
3360
2771
|
}
|
|
3361
2772
|
function addOperationCommands(program, contextFor, recordExitCode) {
|
|
3362
2773
|
const groups = /* @__PURE__ */ new Map();
|
|
3363
|
-
|
|
3364
|
-
|
|
2774
|
+
const examples2 = OPERATION_EXAMPLES;
|
|
2775
|
+
for (const id of HIMRING_OPERATION_IDS) {
|
|
2776
|
+
const cli = HIMRING_OPERATION_CATALOGUE5[id].cli;
|
|
2777
|
+
if (cli === null || cli.workflow) continue;
|
|
2778
|
+
const [resource, verb, ...rest] = cli.command.split(" ");
|
|
2779
|
+
if (!resource || !verb || rest.length > 0) throw new Error(`Invalid command for ${id}.`);
|
|
2780
|
+
const spec = { ...cli, resource, verb, examples: examples2[id] ?? [`himring ${cli.command} --help`] };
|
|
3365
2781
|
addOperationCommand(groupFor(program, groups, spec.resource), id, spec, contextFor, recordExitCode);
|
|
3366
2782
|
}
|
|
3367
2783
|
}
|