🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@mintlify/assistant-core

Package Overview
Dependencies
Maintainers
5
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mintlify/assistant-core - npm Package Compare versions

Package was removed
Sorry, it seems this package was removed from the registry
Comparing version
0.0.8
to
0.0.9
+10
-37
dist/core.js

@@ -39,3 +39,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

data: [],
context: copyContext(options.context),
threadId: persistedContinuation === null || persistedContinuation === void 0 ? void 0 : persistedContinuation.threadId,

@@ -90,5 +89,4 @@ threadKey: persistedContinuation === null || persistedContinuation === void 0 ? void 0 : persistedContinuation.threadKey,

};
const runOperation = (operation, userMessage, regenerate) => __awaiter(this, void 0, void 0, function* () {
const runOperation = (operation, regenerate) => __awaiter(this, void 0, void 0, function* () {
var _a, e_1, _b, _c;
var _d, _e, _f, _g, _h;
const request = {

@@ -100,7 +98,2 @@ messages: snapshot.messages,

coreVersion: ASSISTANT_CORE_API_VERSION,
context: (_d = userMessage.context) === null || _d === void 0 ? void 0 : _d.items,
currentPath: (_e = userMessage.context) === null || _e === void 0 ? void 0 : _e.currentPath,
version: (_f = userMessage.context) === null || _f === void 0 ? void 0 : _f.version,
language: (_g = userMessage.context) === null || _g === void 0 ? void 0 : _g.language,
product: (_h = userMessage.context) === null || _h === void 0 ? void 0 : _h.product,
threadId: snapshot.threadId,

@@ -112,5 +105,5 @@ threadKey: snapshot.threadKey,

try {
for (var _j = true, _k = __asyncValues(options.transport.send(request, operation.controller.signal)), _l; _l = yield _k.next(), _a = _l.done, !_a; _j = true) {
_c = _l.value;
_j = false;
for (var _d = true, _e = __asyncValues(options.transport.send(request, operation.controller.signal)), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
_c = _f.value;
_d = false;
const event = _c;

@@ -125,3 +118,3 @@ if (!isCurrentOperation(operation))

try {
if (!_j && !_a && (_b = _k.return)) yield _b.call(_k);
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
}

@@ -240,3 +233,3 @@ finally { if (e_1) throw e_1.error; }

const send = (input) => __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
var _a, _b;
assertUsable(destroyed);

@@ -257,5 +250,4 @@ if (activeOperation !== undefined) {

}
const context = copyContext((_a = input.context) !== null && _a !== void 0 ? _a : snapshot.context);
const surface = (_b = input.surface) !== null && _b !== void 0 ? _b : options.metadata.surface;
const entryPoint = (_c = input.entryPoint) !== null && _c !== void 0 ? _c : options.metadata.entryPoint;
const surface = (_a = input.surface) !== null && _a !== void 0 ? _a : options.metadata.surface;
const entryPoint = (_b = input.entryPoint) !== null && _b !== void 0 ? _b : options.metadata.entryPoint;
const userMessage = {

@@ -267,3 +259,2 @@ id: createId(),

status: 'complete',
context,
};

@@ -275,3 +266,3 @@ metadataByMessageId.set(userMessage.id, resolveMetadata(options.metadata, surface, entryPoint));

return snapshot;
return runOperation(operation, userMessage, false);
return runOperation(operation, false);
});

@@ -302,3 +293,3 @@ const retry = () => __awaiter(this, void 0, void 0, function* () {

return snapshot;
return runOperation(operation, userMessage, true);
return runOperation(operation, true);
});

@@ -320,3 +311,2 @@ const newThread = () => {

data: [],
context: snapshot.context,
unavailable: AVAILABLE,

@@ -328,6 +318,2 @@ });

};
const setContext = (context) => {
assertUsable(destroyed);
publish(Object.assign(Object.assign({}, snapshot), { context: copyContext(context) }));
};
const submitFeedback = (input) => __awaiter(this, void 0, void 0, function* () {

@@ -388,3 +374,2 @@ var _a;

newThread,
setContext,
submitFeedback,

@@ -396,14 +381,2 @@ getSnapshot: () => snapshot,

}
function copyContext(context) {
var _a;
if (context === undefined)
return undefined;
return {
items: (_a = context.items) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign({}, item))),
currentPath: context.currentPath,
version: context.version,
language: context.language,
product: context.product,
};
}
function getOperationMetadata(metadata, operation) {

@@ -410,0 +383,0 @@ return resolveMetadata(metadata, operation.surface, operation.entryPoint);

export { ASSISTANT_CORE_API_VERSION, ASSISTANT_SURFACES } from './constants.js';
export { createAssistantCore } from './core.js';
export { AssistantError, AssistantTransportError, getUnavailableForStatus } from './errors.js';
export type { AssistantCancellationSignal, AssistantContext, AssistantContextItem, AssistantContinuation, AssistantCore, AssistantCoreOptions, AssistantDataPart, AssistantErrorCode, AssistantErrorSnapshot, AssistantFeedback, AssistantFeedbackInput, AssistantLifecycleEvent, AssistantLifecycleMetadata, AssistantMessage, AssistantMessagePart, AssistantMessageStatus, AssistantMetadata, AssistantSendInput, AssistantSnapshot, AssistantSourcePart, AssistantStatus, AssistantStorageAdapter, AssistantSurface, AssistantTextPart, AssistantToolPart, AssistantTransport, AssistantTransportEvent, AssistantTransportFeedbackRequest, AssistantTransportSendRequest, AssistantUnavailable, AssistantUnavailableType, } from './types.js';
export type { AssistantCancellationSignal, AssistantContinuation, AssistantCore, AssistantCoreOptions, AssistantDataPart, AssistantErrorCode, AssistantErrorSnapshot, AssistantFeedback, AssistantFeedbackInput, AssistantLifecycleEvent, AssistantLifecycleMetadata, AssistantMessage, AssistantMessagePart, AssistantMessageStatus, AssistantMetadata, AssistantSendInput, AssistantSnapshot, AssistantSourcePart, AssistantStatus, AssistantStorageAdapter, AssistantSurface, AssistantTextPart, AssistantToolPart, AssistantTransport, AssistantTransportEvent, AssistantTransportFeedbackRequest, AssistantTransportSendRequest, AssistantUnavailable, AssistantUnavailableType, } from './types.js';
export type AssistantSurface = 'floating-widget' | 'custom-trigger' | 'headless';
export type AssistantContextItem = {
readonly type: 'code' | 'textSelection';
readonly value: string;
readonly path?: string;
readonly elementId?: string;
};
export type AssistantContext = {
readonly items?: ReadonlyArray<AssistantContextItem>;
readonly currentPath?: string;
readonly version?: string;
readonly language?: string;
readonly product?: string;
};
export type AssistantFeedback = 'positive' | 'negative';

@@ -53,3 +40,2 @@ export type AssistantUnavailableType = 'rate_limited' | 'blocked' | 'heuristic_blocked' | 'thread_limit' | 'payment' | 'unknown' | 'not_found' | 'captcha_required' | 'stream_error';

readonly status: AssistantMessageStatus;
readonly context?: AssistantContext;
/** The server message ID returned through X-Message-Id. */

@@ -74,3 +60,2 @@ readonly messageId?: string;

readonly data: ReadonlyArray<unknown>;
readonly context?: AssistantContext;
readonly threadId?: string;

@@ -100,7 +85,2 @@ readonly threadKey?: string;

readonly coreVersion: string;
readonly context?: ReadonlyArray<AssistantContextItem>;
readonly currentPath?: string;
readonly version?: string;
readonly language?: string;
readonly product?: string;
readonly threadId?: string;

@@ -179,3 +159,2 @@ readonly threadKey?: string;

readonly metadata: AssistantMetadata;
readonly context?: AssistantContext;
readonly createId?: () => string;

@@ -186,3 +165,2 @@ readonly onEvent?: (event: AssistantLifecycleEvent) => void;

readonly content: string;
readonly context?: AssistantContext;
readonly surface?: AssistantSurface;

@@ -200,3 +178,2 @@ readonly entryPoint?: string;

newThread(): AssistantSnapshot;
setContext(context?: AssistantContext): void;
submitFeedback(input: AssistantFeedbackInput): Promise<void>;

@@ -203,0 +180,0 @@ getSnapshot(): AssistantSnapshot;

@@ -66,3 +66,2 @@ import { createAssistantCore } from '../dist/index.js';

assistant.setContext({ currentPath: '/quickstart', language: 'en' });
const firstSnapshot = await assistant.send({ content: 'How do I get started?' });

@@ -69,0 +68,0 @@ const firstResponse = firstSnapshot.messages.find((message) => message.role === 'assistant');

@@ -9,7 +9,6 @@ import { createAssistantCore } from '../dist/index.js';

*/
export async function runAssistantWorkflow({ transport, storage, question, context, recordEvent }) {
export async function runAssistantWorkflow({ transport, storage, question, recordEvent }) {
const assistant = createAssistantCore({
transport,
storage,
context,
metadata: {

@@ -16,0 +15,0 @@ surface: 'headless',

{
"name": "@mintlify/assistant-core",
"version": "0.0.8",
"version": "0.0.9",
"description": "Framework-independent state and transport core for Mintlify Assistant",

@@ -53,3 +53,3 @@ "type": "module",

},
"gitHead": "f63c58070a70af6127b27ce62b289b9149e8cd12"
"gitHead": "c33f53d9c98ca3b7c6e67e435e9aecb9d48ba569"
}

@@ -51,4 +51,3 @@ # `@mintlify/assistant-core`

| `submitFeedback(input)` | Sends feedback using the server-issued message ID and original attribution. |
| `newThread()` | Aborts pending work, clears continuation state, and keeps the current context. |
| `setContext(context)` | Replaces the default context used by later sends. |
| `newThread()` | Aborts pending work and clears continuation state. |
| `destroy()` | Aborts pending work, removes subscriptions, and destroys the injected transport. |

@@ -62,3 +61,3 @@

## Context and attribution
## Attribution

@@ -69,10 +68,2 @@ The default metadata identifies the integration. A send can override `surface` and `entryPoint`

Context supports selection/code items plus `currentPath`, `version`, `language`, and `product`.
These values are delivered to the injected transport. The current Assistant widget HTTP endpoint
accepts only items and `currentPath`; browser transports must deliberately omit the other three
fields until the server contract supports them.
Do not place secrets, raw identity tokens, or arbitrary personally identifiable attributes in
context.
## Sessions and storage

@@ -92,3 +83,3 @@

resolved surface, entry point, loader version when present, and core compatibility version. They do
not include message bodies, context, or thread keys.
not include message bodies or thread keys.

@@ -101,4 +92,4 @@ The core injects `ASSISTANT_CORE_API_VERSION` as the stable compatibility major sent in

Browser mounting, Widget ID session exchange, the loader, navigation adapters, and the maintained
Browser mounting, Widget ID session exchange, the loader, and the maintained
renderer belong to `@mintlify/assistant-web`. Import that package explicitly when those behaviors
are required. `@mintlify/assistant-core` never selects or imports a browser adapter automatically.