@nymbalhq/platform 1.6.0 → 1.7.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/dist/{chunk-KH3BABMV.js → chunk-PYB26JT2.js} +364 -20
- package/dist/chunk-PYB26JT2.js.map +1 -0
- package/dist/db/schema/index.d.ts +4 -4
- package/dist/index.d.ts +17 -1
- package/dist/index.js +51 -3
- package/dist/index.js.map +1 -1
- package/dist/{register-XP5XVAXM.js → register-NPVDXQ2B.js} +2 -2
- package/package.json +5 -5
- package/dist/chunk-KH3BABMV.js.map +0 -1
- /package/dist/{register-XP5XVAXM.js.map → register-NPVDXQ2B.js.map} +0 -0
|
@@ -2035,7 +2035,7 @@ declare const orderAccessKeys$1: drizzle_orm_sqlite_core.SQLiteTableWithColumns<
|
|
|
2035
2035
|
tableName: "order_access_keys";
|
|
2036
2036
|
dataType: "string";
|
|
2037
2037
|
columnType: "SQLiteText";
|
|
2038
|
-
data: "
|
|
2038
|
+
data: "email" | "checkout";
|
|
2039
2039
|
driverParam: string;
|
|
2040
2040
|
notNull: true;
|
|
2041
2041
|
hasDefault: false;
|
|
@@ -6171,7 +6171,7 @@ declare const schema$1: {
|
|
|
6171
6171
|
tableName: "order_access_keys";
|
|
6172
6172
|
dataType: "string";
|
|
6173
6173
|
columnType: "SQLiteText";
|
|
6174
|
-
data: "
|
|
6174
|
+
data: "email" | "checkout";
|
|
6175
6175
|
driverParam: string;
|
|
6176
6176
|
notNull: true;
|
|
6177
6177
|
hasDefault: false;
|
|
@@ -10343,7 +10343,7 @@ declare const orderAccessKeys: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
10343
10343
|
tableName: "order_access_keys";
|
|
10344
10344
|
dataType: "string";
|
|
10345
10345
|
columnType: "PgText";
|
|
10346
|
-
data: "
|
|
10346
|
+
data: "email" | "checkout";
|
|
10347
10347
|
driverParam: string;
|
|
10348
10348
|
notNull: true;
|
|
10349
10349
|
hasDefault: false;
|
|
@@ -14131,7 +14131,7 @@ declare const schema: {
|
|
|
14131
14131
|
tableName: "order_access_keys";
|
|
14132
14132
|
dataType: "string";
|
|
14133
14133
|
columnType: "PgText";
|
|
14134
|
-
data: "
|
|
14134
|
+
data: "email" | "checkout";
|
|
14135
14135
|
driverParam: string;
|
|
14136
14136
|
notNull: true;
|
|
14137
14137
|
hasDefault: false;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NymbalConfig } from '@nymbalhq/config';
|
|
1
|
+
import { NymbalConfig, AssistantMaskField } from '@nymbalhq/config';
|
|
2
2
|
export { secureCookies } from '@nymbalhq/config';
|
|
3
3
|
import { Logger, DocumentStoreAdapter, EventBusAdapter, MediaStorage, Product, ProductStatus, ProductType, ProductMedia, Variant, VariantDimensions, VariantOption, VariantStatus, Category, Customer, Role, CustomerAddress, Order, OrderStatus, Address, OrderLineItem, CaptureMethod, OrderSource, OrderHistoryEntry, OrderRefundStatus, OrderRefund, InventoryReservation, StockAdjustmentReason, StockAdjustment, Review, ReviewModerationStatus, NymbalEvent, Cart, AuditSubject, AuditActor, AuditOutcome, AuditEntry, AlertKind, AlertStatus, ProposalStatus, ProposalDecider, ProposalView, HealthReport, PutOptions, QueryParams, QueryResult, EventHandler, SubscriptionConfig, Subscription, NymbalEnvironment, NymbalEventType, NymbalEventMap, RequestAuth, AdapterSetting, CommerceSlotAdapters, SecurityAdapter, AiAdapter, PaymentsAdapter, CartSource, EmailAdapter, ProductSnapshot, CartItem, StockStatus, PaymentIntent, CheckoutPayment, SearchParams, SearchResult, SearchAdapter, OrderPayment, Refund, RecentViewer, ReviewsAdapter, Caller, ToolResult, ProposalPage, CommerceSlot, HttpAdapter, ToolSurface, RequestContext, ResponseEnvelope, RouteHandler, ToolDefinition, JsonSchemaObject, AssistantFrame, ResolvedNetwork, AgentSurfaces, AgentSurfaceUrls, AgentSurfaceAdapter, HealthStatus, SecurityNetwork, OriginLockRule, Slot, ProviderPackageModule, RateLimitAction, AnalyticsAdapter, ShippingAdapter, TaxAdapter } from '@nymbalhq/types';
|
|
4
4
|
export { MediaStorage, buildSecurityHeaders, isValidCorrelationId } from '@nymbalhq/types';
|
|
@@ -2097,6 +2097,19 @@ interface Invoker extends ToolSurface {
|
|
|
2097
2097
|
*/
|
|
2098
2098
|
declare function createInvoker(deps: InvokerDeps): Invoker;
|
|
2099
2099
|
|
|
2100
|
+
/**
|
|
2101
|
+
* Reversible masking of a customer's details for one assistant turn: the AI provider reads `[email-1]` where a tool
|
|
2102
|
+
* result held an email, and each placeholder is turned back into its value before a tool runs and before the admin
|
|
2103
|
+
* sees the answer. The table lives in the turn's memory only.
|
|
2104
|
+
*/
|
|
2105
|
+
type MaskField = AssistantMaskField;
|
|
2106
|
+
/** A revealed value's place in a text: UTF-16 offsets, `end` exclusive. */
|
|
2107
|
+
interface RevealedSpan {
|
|
2108
|
+
start: number;
|
|
2109
|
+
end: number;
|
|
2110
|
+
kind: MaskField;
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2100
2113
|
/** The agent name every tool call, proposal and audit entry of the assistant carries. */
|
|
2101
2114
|
declare const ASSISTANT_AGENT = "nymbal-assistant";
|
|
2102
2115
|
interface AssistantDeps {
|
|
@@ -2117,6 +2130,8 @@ interface AssistantDeps {
|
|
|
2117
2130
|
};
|
|
2118
2131
|
/** `agents.assistant.customerData`: false leaves out every tool whose answer carries a customer's details. */
|
|
2119
2132
|
customerData?: boolean;
|
|
2133
|
+
/** `agents.assistant.mask`: the customer fields the provider reads as placeholders; absent or [] masks nothing. */
|
|
2134
|
+
mask?: readonly MaskField[];
|
|
2120
2135
|
}
|
|
2121
2136
|
interface AssistantTurn {
|
|
2122
2137
|
/** The turn's id, the prefix of each call's correlation id; one is minted when absent. */
|
|
@@ -2127,6 +2142,7 @@ interface AssistantTurn {
|
|
|
2127
2142
|
messages: Array<{
|
|
2128
2143
|
role: 'user' | 'assistant';
|
|
2129
2144
|
content: string;
|
|
2145
|
+
revealed?: RevealedSpan[];
|
|
2130
2146
|
}>;
|
|
2131
2147
|
/** The admin route the panel was opened on, e.g. `/products/ceramic-mug`. */
|
|
2132
2148
|
page?: string;
|
package/dist/index.js
CHANGED
|
@@ -167,7 +167,7 @@ import {
|
|
|
167
167
|
subscribeDerived,
|
|
168
168
|
ucpProduct,
|
|
169
169
|
ucpProfile
|
|
170
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-PYB26JT2.js";
|
|
171
171
|
import {
|
|
172
172
|
alertSubscriptions,
|
|
173
173
|
alertSubscriptions2,
|
|
@@ -5507,7 +5507,8 @@ async function runGolden(app, opts = {}) {
|
|
|
5507
5507
|
proposals: app.services.proposals,
|
|
5508
5508
|
logger,
|
|
5509
5509
|
store: { name: config.store.name, currency: config.store.currency },
|
|
5510
|
-
customerData: config.agents.assistant.customerData
|
|
5510
|
+
customerData: config.agents.assistant.customerData,
|
|
5511
|
+
mask: config.agents.assistant.mask
|
|
5511
5512
|
},
|
|
5512
5513
|
{
|
|
5513
5514
|
caller,
|
|
@@ -7020,7 +7021,7 @@ async function createApp(config, options = {}) {
|
|
|
7020
7021
|
);
|
|
7021
7022
|
}
|
|
7022
7023
|
await adapters.security.applyMiddleware(adapter, config.security);
|
|
7023
|
-
const { registerAllRoutes: registerAllRoutes2 } = await import("./register-
|
|
7024
|
+
const { registerAllRoutes: registerAllRoutes2 } = await import("./register-NPVDXQ2B.js");
|
|
7024
7025
|
const table = new RouteTable();
|
|
7025
7026
|
registerAllRoutes2({
|
|
7026
7027
|
config,
|
|
@@ -7211,6 +7212,8 @@ import { existsSync } from "fs";
|
|
|
7211
7212
|
import { resolve as resolve3 } from "path";
|
|
7212
7213
|
import { fileURLToPath } from "url";
|
|
7213
7214
|
import {
|
|
7215
|
+
ASSISTANT_MASK_FIELDS,
|
|
7216
|
+
DEFAULT_ASSISTANT_MASK,
|
|
7214
7217
|
nymbalConfigSchema,
|
|
7215
7218
|
resolveOriginLock as resolveOriginLock2,
|
|
7216
7219
|
slotFolder
|
|
@@ -7476,6 +7479,9 @@ async function diagnose(input, options = {}) {
|
|
|
7476
7479
|
} else {
|
|
7477
7480
|
slots.push(fromReport(`slot ${slot}`, provider, await health(adapter.value)));
|
|
7478
7481
|
}
|
|
7482
|
+
if (slot === "ai" && slots.at(-1)?.status !== "down") {
|
|
7483
|
+
slots.push(aiHostCheck(config, provider, adapter.ok ? adapter.value : null));
|
|
7484
|
+
}
|
|
7479
7485
|
}
|
|
7480
7486
|
const securityAdapter = await within(
|
|
7481
7487
|
timeoutMs,
|
|
@@ -7579,6 +7585,48 @@ async function eventLogCheck(store, timeoutMs) {
|
|
|
7579
7585
|
function fromReport(name, what, report) {
|
|
7580
7586
|
return { name, status: report.status, detail: described(what, report.detail) };
|
|
7581
7587
|
}
|
|
7588
|
+
function placeOf(hostname) {
|
|
7589
|
+
const name = hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
7590
|
+
if (name.includes(":")) {
|
|
7591
|
+
if (name === "::1") return "this machine";
|
|
7592
|
+
const first = name.startsWith("::") ? 0 : parseInt(name.split(":")[0], 16);
|
|
7593
|
+
if ((first & 65024) === 64512 || (first & 65472) === 65152) return "your network";
|
|
7594
|
+
return "remote";
|
|
7595
|
+
}
|
|
7596
|
+
const octets = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(name)?.slice(1).map(Number);
|
|
7597
|
+
if (octets !== void 0) {
|
|
7598
|
+
const [a, b] = octets;
|
|
7599
|
+
if (a === 127 || name === "0.0.0.0") return "this machine";
|
|
7600
|
+
if (a === 10 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 169 && b === 254 || a === 100 && b >= 64 && b <= 127) {
|
|
7601
|
+
return "your network";
|
|
7602
|
+
}
|
|
7603
|
+
return "remote";
|
|
7604
|
+
}
|
|
7605
|
+
if (name === "localhost" || name.endsWith(".localhost")) return "this machine";
|
|
7606
|
+
if (!name.includes(".") || /\.(local|internal|lan|home\.arpa)$/.test(name)) return "your network";
|
|
7607
|
+
return "remote";
|
|
7608
|
+
}
|
|
7609
|
+
function aiHostCheck(config, provider, adapter) {
|
|
7610
|
+
const name = "ai host";
|
|
7611
|
+
if (adapter === null) return { name, status: "ok", detail: `${provider}: the assistant is off` };
|
|
7612
|
+
const endpoint = adapter.endpoint;
|
|
7613
|
+
if (typeof endpoint !== "string") {
|
|
7614
|
+
return {
|
|
7615
|
+
name,
|
|
7616
|
+
status: "ok",
|
|
7617
|
+
detail: `${provider}: its adapter does not say where it sends requests`
|
|
7618
|
+
};
|
|
7619
|
+
}
|
|
7620
|
+
const url = URL.parse(endpoint);
|
|
7621
|
+
if (url === null || url.host === "") {
|
|
7622
|
+
return { name, status: "degraded", detail: `${provider}: its endpoint is not a URL` };
|
|
7623
|
+
}
|
|
7624
|
+
const assistant = config.agents?.assistant;
|
|
7625
|
+
const mask = assistant?.mask ?? DEFAULT_ASSISTANT_MASK;
|
|
7626
|
+
const listed = ASSISTANT_MASK_FIELDS.filter((field) => mask.includes(field));
|
|
7627
|
+
const data = assistant?.customerData === false ? "customer data off" : listed.length === 0 ? "customer fields sent as they are" : `customer fields masked: ${listed.join(", ")}; ${listed.includes("name") ? "" : "names, "}city and notes sent`;
|
|
7628
|
+
return { name, status: "ok", detail: `${url.host} (${placeOf(url.hostname)}): ${data}` };
|
|
7629
|
+
}
|
|
7582
7630
|
|
|
7583
7631
|
// src/read-models/open.ts
|
|
7584
7632
|
async function openReadModels(config, options) {
|