@alexein/sdk 0.3.2 → 0.3.3

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.
@@ -11,13 +11,13 @@
11
11
 
12
12
 
13
13
 
14
- var _chunkVNLJZ26Ccjs = require('./chunk-VNLJZ26C.cjs');
14
+ var _chunkLWBADF3Fcjs = require('./chunk-LWBADF3F.cjs');
15
15
 
16
16
 
17
17
 
18
18
 
19
19
 
20
- var _chunkAJGT53UZcjs = require('./chunk-AJGT53UZ.cjs');
20
+ var _chunk34W2JJVDcjs = require('./chunk-34W2JJVD.cjs');
21
21
 
22
22
  // src/openai-agents/run.ts
23
23
  function userIdOf(context) {
@@ -53,7 +53,7 @@ function answer(output) {
53
53
  }
54
54
  async function item(said, role, turn, author) {
55
55
  if (!said.trim()) return void 0;
56
- const id = await _chunkVNLJZ26Ccjs.stableId.call(void 0, turn, role, said);
56
+ const id = await _chunkLWBADF3Fcjs.stableId.call(void 0, turn, role, said);
57
57
  return { id, role, text: said, ...author ? { author } : {} };
58
58
  }
59
59
  async function turnItems(result, session) {
@@ -73,13 +73,13 @@ var _agents = require('@openai/agents');
73
73
  var _zod = require('zod');
74
74
  function failed(strict) {
75
75
  return (run, error) => {
76
- const yours = error instanceof _chunkAJGT53UZcjs.AuthenticationError || error instanceof _chunkAJGT53UZcjs.PermissionDeniedError;
77
- const outage = error instanceof _chunkAJGT53UZcjs.AlexeinError && error.outage;
76
+ const yours = error instanceof _chunk34W2JJVDcjs.AuthenticationError || error instanceof _chunk34W2JJVDcjs.PermissionDeniedError;
77
+ const outage = error instanceof _chunk34W2JJVDcjs.AlexeinError && error.outage;
78
78
  const noUser = !_optionalChain([run, 'access', _5 => _5.context, 'optionalAccess', _6 => _6.userId]);
79
79
  if (yours || noUser || strict && outage) throw error;
80
80
  if (outage) {
81
81
  console.warn(`Alexein is unavailable: ${error.message}`);
82
- return _chunkVNLJZ26Ccjs.UNAVAILABLE;
82
+ return _chunkLWBADF3Fcjs.UNAVAILABLE;
83
83
  }
84
84
  return `That did not work: ${error instanceof Error ? error.message : String(error)}`;
85
85
  };
@@ -92,8 +92,8 @@ function buildTools(memory, write) {
92
92
  parameters: _zod.z.object({ query: _zod.z.string().describe("What to look for") }),
93
93
  errorFunction,
94
94
  async execute({ query }, run) {
95
- const found = await _chunkVNLJZ26Ccjs.searchFor.call(void 0, memory.userOf(_optionalChain([run, 'optionalAccess', _7 => _7.context])), query, memory.fast);
96
- return _chunkVNLJZ26Ccjs.searchAnswer.call(void 0, found, memory.maxChars);
95
+ const found = await _chunkLWBADF3Fcjs.searchFor.call(void 0, memory.userOf(_optionalChain([run, 'optionalAccess', _7 => _7.context])), query, memory.fast);
96
+ return _chunkLWBADF3Fcjs.searchAnswer.call(void 0, found, memory.maxChars);
97
97
  }
98
98
  });
99
99
  const open = _agents.tool.call(void 0, {
@@ -103,10 +103,10 @@ function buildTools(memory, write) {
103
103
  errorFunction,
104
104
  async execute({ ref }, run) {
105
105
  try {
106
- return _chunkVNLJZ26Ccjs.openAnswer.call(void 0, await memory.userOf(_optionalChain([run, 'optionalAccess', _8 => _8.context])).open(ref));
106
+ return _chunkLWBADF3Fcjs.openAnswer.call(void 0, await memory.userOf(_optionalChain([run, 'optionalAccess', _8 => _8.context])).open(ref));
107
107
  } catch (error) {
108
- if (!(error instanceof _chunkAJGT53UZcjs.NotFoundError)) throw error;
109
- return _chunkVNLJZ26Ccjs.notFoundAnswer.call(void 0, error);
108
+ if (!(error instanceof _chunk34W2JJVDcjs.NotFoundError)) throw error;
109
+ return _chunkLWBADF3Fcjs.notFoundAnswer.call(void 0, error);
110
110
  }
111
111
  }
112
112
  });
@@ -120,7 +120,7 @@ function buildTools(memory, write) {
120
120
  kind: "note",
121
121
  session: sessionIdOf(_optionalChain([run, 'optionalAccess', _10 => _10.context]))
122
122
  });
123
- return saved.failed ? _chunkVNLJZ26Ccjs.UNAVAILABLE : _chunkVNLJZ26Ccjs.SAVED;
123
+ return saved.failed ? _chunkLWBADF3Fcjs.UNAVAILABLE : _chunkLWBADF3Fcjs.SAVED;
124
124
  }
125
125
  });
126
126
  return write ? [search, open, add] : [search, open];
@@ -149,12 +149,12 @@ var AlexeinMemory = (_class = class {
149
149
  #recalled = /* @__PURE__ */ new WeakMap();
150
150
  /** `client` defaults to one made on first use: fail-open unless strict, a 10 s timeout. */
151
151
  constructor(client, options = {}) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);
152
- const given = _chunkVNLJZ26Ccjs.isClient.call(void 0, client) ? client : void 0;
153
- const settings = _chunkVNLJZ26Ccjs.isClient.call(void 0, client) ? options : { ...client, ...options };
152
+ const given = _chunkLWBADF3Fcjs.isClient.call(void 0, client) ? client : void 0;
153
+ const settings = _chunkLWBADF3Fcjs.isClient.call(void 0, client) ? options : { ...client, ...options };
154
154
  this.fast = _nullishCoalesce(settings.fast, () => ( false));
155
155
  this.maxChars = _nullishCoalesce(settings.maxChars, () => ( 4e3));
156
156
  this.strict = _nullishCoalesce(settings.strict, () => ( false));
157
- this.#client = new (0, _chunkVNLJZ26Ccjs.LazyClient)(given, "openai-agents", this.strict, settings.timeout);
157
+ this.#client = new (0, _chunkLWBADF3Fcjs.LazyClient)(given, "openai-agents", this.strict, settings.timeout);
158
158
  }
159
159
  get client() {
160
160
  return this.#client.client;
@@ -180,8 +180,8 @@ var AlexeinMemory = (_class = class {
180
180
  question = said && textOf(said).trim();
181
181
  }
182
182
  if (question !== void 0) {
183
- const found = question ? await _chunkVNLJZ26Ccjs.searchFor.call(void 0, user, question, this.fast) : void 0;
184
- this.#recalled.set(run, _chunkVNLJZ26Ccjs.promptBlock.call(void 0, _nullishCoalesce(_optionalChain([found, 'optionalAccess', _17 => _17.context, 'call', _18 => _18(this.maxChars)]), () => ( ""))));
183
+ const found = question ? await _chunkLWBADF3Fcjs.searchFor.call(void 0, user, question, this.fast) : void 0;
184
+ this.#recalled.set(run, _chunkLWBADF3Fcjs.promptBlock.call(void 0, _nullishCoalesce(_optionalChain([found, 'optionalAccess', _17 => _17.context, 'call', _18 => _18(this.maxChars)]), () => ( ""))));
185
185
  }
186
186
  const block = this.#recalled.get(run);
187
187
  if (!block) return modelData;
@@ -231,4 +231,4 @@ var memoryTools = (options = {}) => defaultMemory().tools(options);
231
231
 
232
232
 
233
233
 
234
- exports.AlexeinMemory = AlexeinMemory; exports.NOTHING_FOUND = _chunkVNLJZ26Ccjs.NOTHING_FOUND; exports.NOTHING_YET = _chunkVNLJZ26Ccjs.NOTHING_YET; exports.UNAVAILABLE = _chunkVNLJZ26Ccjs.UNAVAILABLE; exports.defaultMemory = defaultMemory; exports.memoryTools = memoryTools; exports.recall = recall; exports.remember = remember; exports.sessionIdOf = sessionIdOf; exports.userIdOf = userIdOf;
234
+ exports.AlexeinMemory = AlexeinMemory; exports.NOTHING_FOUND = _chunkLWBADF3Fcjs.NOTHING_FOUND; exports.NOTHING_YET = _chunkLWBADF3Fcjs.NOTHING_YET; exports.UNAVAILABLE = _chunkLWBADF3Fcjs.UNAVAILABLE; exports.defaultMemory = defaultMemory; exports.memoryTools = memoryTools; exports.recall = recall; exports.remember = remember; exports.sessionIdOf = sessionIdOf; exports.userIdOf = userIdOf;
@@ -1,5 +1,5 @@
1
1
  import { AgentInputItem, CallModelInputFilterArgs, ModelInputData, FunctionTool } from '@openai/agents';
2
- import { v as Memory, X as User } from './client-DJsIRKil.cjs';
2
+ import { N as Memory, a4 as User } from './client-Bz10lVYG.cjs';
3
3
  import { I as IntegrationOptions } from './shared-Btg8LbKC.cjs';
4
4
  export { N as NOTHING_FOUND, a as NOTHING_YET, U as UNAVAILABLE } from './shared-Btg8LbKC.cjs';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { AgentInputItem, CallModelInputFilterArgs, ModelInputData, FunctionTool } from '@openai/agents';
2
- import { v as Memory, X as User } from './client-DJsIRKil.js';
2
+ import { N as Memory, a4 as User } from './client-Bz10lVYG.js';
3
3
  import { I as IntegrationOptions } from './shared-Btg8LbKC.js';
4
4
  export { N as NOTHING_FOUND, a as NOTHING_YET, U as UNAVAILABLE } from './shared-Btg8LbKC.js';
5
5
 
@@ -11,13 +11,13 @@ import {
11
11
  searchAnswer,
12
12
  searchFor,
13
13
  stableId
14
- } from "./chunk-5Y43EWDD.js";
14
+ } from "./chunk-HDNKPJS2.js";
15
15
  import {
16
16
  AlexeinError,
17
17
  AuthenticationError,
18
18
  NotFoundError,
19
19
  PermissionDeniedError
20
- } from "./chunk-CKBVQNV5.js";
20
+ } from "./chunk-5YIOYX3J.js";
21
21
 
22
22
  // src/openai-agents/run.ts
23
23
  function userIdOf(context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexein/sdk",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "JavaScript and TypeScript client for Alexein: long-term memory for your users and agents, with LangGraph.js and OpenAI Agents SDK integrations.",
5
5
  "license": "MIT",
6
6
  "author": "Alexein AI",