@m6d/cortex 0.5.0 → 0.6.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/README.md +35 -0
- package/dist/drizzle.js +1 -1
- package/dist/{index-jw8cnjqv.js → index-969vtyhy.js} +1 -3
- package/dist/index.d.ts +5893 -70
- package/dist/index.js +547 -200
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -129,6 +129,33 @@ if (isFiringRunning(firing)) {
|
|
|
129
129
|
|
|
130
130
|
A firing parked on a tool that needs approval is resumed with `triggers.answer`. Until it is, a firing on the same thread (a `single` or `keyed` policy) is dropped with reason `approval_pending` (409). A status other than 2xx, 409 or 422, or a body that is no firing, throws `TriggerClientError`.
|
|
131
131
|
|
|
132
|
+
## Management API
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
import { createManagementClient, ManagementClientError, type ManagementOutput } from "@m6d/cortex";
|
|
136
|
+
|
|
137
|
+
const cortex = createManagementClient({
|
|
138
|
+
url: "https://cortex.example.com", // the console's origin
|
|
139
|
+
key: process.env.CORTEX_MANAGEMENT_KEY!, // a management key, cortex_mgmt_…
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const agent: ManagementOutput<"agents.get"> = await cortex.agents.get({ id });
|
|
143
|
+
try {
|
|
144
|
+
// Each setting sent is replaced whole, so the other locales go along; the
|
|
145
|
+
// settings left out keep their values.
|
|
146
|
+
await cortex.agents.saveSettings({
|
|
147
|
+
id,
|
|
148
|
+
greeting: { ...agent.greeting, en: "How can I help?" },
|
|
149
|
+
});
|
|
150
|
+
} catch (error) {
|
|
151
|
+
if (!(error instanceof ManagementClientError)) throw error;
|
|
152
|
+
// error.status 403, error.code "FORBIDDEN", error.message "read_only",
|
|
153
|
+
// error.detail { error: "read_only", fields: [...] }, error.refusal: Cortex's sentence, when it has one
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Every procedure of [the management API](../../apps/cortex/docs/management-api.md) is a typed call, `cortex.<router>.<procedure>(input)`: a query is sent as a GET, a mutation as a POST, its input and output typed from the procedures of the Cortex release this package ships with (`ManagementInput<"…">` and `ManagementOutput<"…">` name them). A refusal throws `ManagementClientError`; a Cortex that cannot be reached rejects as `fetch` does. M6d.Cortex has the same client for .NET.
|
|
158
|
+
|
|
132
159
|
## Manifests
|
|
133
160
|
|
|
134
161
|
```ts
|
|
@@ -153,6 +180,14 @@ export default defineManifest({
|
|
|
153
180
|
audience: { agents: ["support"] },
|
|
154
181
|
},
|
|
155
182
|
],
|
|
183
|
+
collections: [
|
|
184
|
+
{
|
|
185
|
+
name: "Order policies",
|
|
186
|
+
// Read from beside this file by `cortex apply`.
|
|
187
|
+
documents: [{ path: "./docs/returns.pdf" }],
|
|
188
|
+
audience: { agents: ["support"] },
|
|
189
|
+
},
|
|
190
|
+
],
|
|
156
191
|
});
|
|
157
192
|
```
|
|
158
193
|
|
package/dist/drizzle.js
CHANGED
|
@@ -59,9 +59,6 @@ function contentVersion(value) {
|
|
|
59
59
|
return createHash("sha256").update(JSON.stringify(value)).digest("hex");
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
// ../../internal/contracts/src/datasets/datasets.ts
|
|
63
|
-
import { z as z2 } from "zod";
|
|
64
|
-
|
|
65
62
|
// ../../internal/contracts/src/json/index.ts
|
|
66
63
|
function isRecord(value) {
|
|
67
64
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -98,6 +95,7 @@ function readJsonPointer(document, pointer) {
|
|
|
98
95
|
}
|
|
99
96
|
|
|
100
97
|
// ../../internal/contracts/src/datasets/datasets.ts
|
|
98
|
+
import { z as z2 } from "zod";
|
|
101
99
|
var DATASET_IDENTIFIER_PATTERN = /^[a-zA-Z][a-zA-Z0-9_]*$/;
|
|
102
100
|
var DATASET_IDENTIFIER_MAX = 64;
|
|
103
101
|
var DATASET_COLUMN_REF_PATTERN = /^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)*$/;
|