@personize/sdk 0.4.0 → 0.5.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Personize SDK
2
2
 
3
- The official Node.js/TypeScript SDK for the Personize Product API. Authenticate with your secret key to access variables, smart context, RAG memory, prompt execution, agents, and evaluation tools.
3
+ The official Node.js/TypeScript SDK for the Personize Product API. Authenticate with your secret key to access guidelines, smart guidelines, RAG memory, prompt execution, agents, and evaluation tools.
4
4
 
5
5
  ## Installation
6
6
 
@@ -36,7 +36,7 @@ console.log(me.data.plan.limits);
36
36
  | GET | `/api/v1/test` | `client.test()` |
37
37
  | GET | `/api/v1/me` | `client.me()` |
38
38
  | **AI** | | |
39
- | POST | `/api/v1/ai/smart-context` | `client.ai.smartContext(opts)` |
39
+ | POST | `/api/v1/ai/smart-guidelines` | `client.ai.smartGuidelines(opts)` |
40
40
  | POST | `/api/v1/prompt` | `client.ai.prompt(opts)` |
41
41
  | **Memory** | | |
42
42
  | POST | `/api/v1/memorize` | `client.memory.memorize(opts)` |
@@ -47,14 +47,14 @@ console.log(me.data.plan.limits);
47
47
  | POST | `/api/v1/upsert` | `client.memory.upsertBatch(opts)` |
48
48
  | POST | `/api/v1/batch-memorize` | `client.memory.memorizeBatch(opts)` |
49
49
  | POST | `/api/v1/smart-memory-digest` | `client.memory.smartDigest(opts)` |
50
- | **Variables** | | |
51
- | GET | `/api/v1/variables` | `client.variables.list()` |
52
- | POST | `/api/v1/variables` | `client.variables.create(payload)` |
53
- | GET | `/api/v1/variables/:id/structure` | `client.variables.getStructure(id)` |
54
- | GET | `/api/v1/variables/:id/section` | `client.variables.getSection(id, opts)` |
55
- | PATCH | `/api/v1/variables/:id` | `client.variables.update(id, payload)` |
56
- | DELETE | `/api/v1/variables/:id` | `client.variables.delete(id)` |
57
- | GET | `/api/v1/actions/:id/history` | `client.variables.history(id)` |
50
+ | **Guidelines** | | |
51
+ | GET | `/api/v1/guidelines` | `client.guidelines.list()` |
52
+ | POST | `/api/v1/guidelines` | `client.guidelines.create(payload)` |
53
+ | GET | `/api/v1/guidelines/:id/structure` | `client.guidelines.getStructure(id)` |
54
+ | GET | `/api/v1/guidelines/:id/section` | `client.guidelines.getSection(id, opts)` |
55
+ | PATCH | `/api/v1/guidelines/:id` | `client.guidelines.update(id, payload)` |
56
+ | DELETE | `/api/v1/guidelines/:id` | `client.guidelines.delete(id)` |
57
+ | GET | `/api/v1/actions/:id/history` | `client.guidelines.history(id)` |
58
58
  | **Collections** | | |
59
59
  | GET | `/api/v1/collections` | `client.collections.list()` |
60
60
  | POST | `/api/v1/collections` | `client.collections.create(payload)` |
@@ -72,35 +72,35 @@ All endpoints require `Authorization: Bearer sk_live_...` and count against your
72
72
 
73
73
  ## Usage
74
74
 
75
- ### Variables
75
+ ### Guidelines
76
76
 
77
77
  ```typescript
78
- // List all variables
79
- const vars = await client.variables.list();
78
+ // List all guidelines
79
+ const vars = await client.guidelines.list();
80
80
 
81
- // Create a variable
82
- await client.variables.create({ name: 'ICP', value: '...', tags: ['sales'] });
81
+ // Create a guideline
82
+ await client.guidelines.create({ name: 'ICP', value: '...', tags: ['sales'] });
83
83
 
84
- // Update a variable
85
- await client.variables.update(variableId, { value: 'new content' });
84
+ // Update a guideline
85
+ await client.guidelines.update(guidelineId, { value: 'new content' });
86
86
 
87
- // Get variable structure (headings)
88
- const structure = await client.variables.getStructure(variableId);
87
+ // Get guideline structure (headings)
88
+ const structure = await client.guidelines.getStructure(guidelineId);
89
89
 
90
90
  // Get a specific section
91
- const section = await client.variables.getSection(variableId, { header: '## Pricing' });
91
+ const section = await client.guidelines.getSection(guidelineId, { header: '## Pricing' });
92
92
 
93
- // Delete a variable
94
- await client.variables.delete(variableId);
93
+ // Delete a guideline
94
+ await client.guidelines.delete(guidelineId);
95
95
 
96
96
  // Version history
97
- const history = await client.variables.history(variableId, { limit: 5 });
97
+ const history = await client.guidelines.history(guidelineId, { limit: 5 });
98
98
  ```
99
99
 
100
- ### Smart Context
100
+ ### Smart Guidelines
101
101
 
102
102
  ```typescript
103
- const ctx = await client.ai.smartContext({
103
+ const ctx = await client.ai.smartGuidelines({
104
104
  message: 'Write a sales sequence for our top 3 ICPs',
105
105
  tags: ['sales'],
106
106
  excludeTags: ['internal'],
@@ -307,7 +307,7 @@ console.log(evaluation.data.summary.propertiesOptimized);
307
307
  | Option | Type | Required | Description |
308
308
  | :--- | :--- | :--- | :--- |
309
309
  | `secretKey` | string | Yes | Your secret key (`sk_live_...`). |
310
- | `baseURL` | string | No | Custom API endpoint (default: `https://api.personize.ai`). |
310
+ | `baseURL` | string | No | Custom API endpoint (default: `https://agent.personize.ai`). |
311
311
  | `timeout` | number | No | Request timeout in ms (default: `30000`). |
312
312
  | `maxRetries` | number | No | Max retry attempts for 429/5xx errors (default: `3`). |
313
313
  | `retryDelay` | number | No | Base delay in ms for exponential backoff (default: `1000`). |
@@ -340,75 +340,16 @@ const client = new Personize({
340
340
  - `client.memory.search(opts)` — Search/filter records with `property`-based conditions
341
341
  - `client.evaluate.memorizationAccuracy(opts)` — Three-phase memorization evaluation
342
342
  - `attachments` on `PromptOptions` — Multimodal support (images, PDFs, documents)
343
- - `sessionId` on `SmartContextOptions` — Progressive context delivery across multi-step workflows
343
+ - `sessionId` on `SmartGuidelinesOptions` — Progressive context delivery across multi-step workflows
344
344
  - New fields on `MemorizeOptions`: `collectionIds`, `skipStorage`, `skipDualWrite`, `skipPropertySelection`
345
345
  - New fields on `SmartRecallOptions`: `max_reflection_rounds`, `filters`
346
346
 
347
347
  ## Skills
348
348
 
349
- The SDK ships with AI-assistant skills in `skills/` that teach Claude Code, Codex, and Cursor how to use the SDK for common workflows.
349
+ AI-assistant skills for Claude Code, Codex, and Cursor are available separately:
350
350
 
351
- ### Integration Builder (`skills/integrations/`)
352
-
353
- Build CRM/database sync integrations. Connect Salesforce, HubSpot, Postgres, or any data source to Personize memory with batch memorization and scheduled deployment.
354
-
355
- ```
356
- skills/integrations/
357
- ├── CLAUDE.md # Main skill instructions
358
- ├── templates/
359
- │ ├── salesforce.md # Salesforce connector pattern
360
- │ ├── hubspot.md # HubSpot connector pattern
361
- │ └── postgres.md # Postgres/MySQL pattern
362
- └── deploy/
363
- ├── Dockerfile # Container deployment
364
- ├── render.yaml # Render cron service
365
- └── github-action.yml # GitHub Actions schedule
366
- ```
367
-
368
- ### Governance (`skills/governance/`)
369
-
370
- Manage variables as code — maintain a `governance/variables/` folder of `.md` files and sync them to the Personize API.
371
-
372
- ```
373
- skills/governance/
374
- ├── CLAUDE.md # Main skill instructions
375
- ├── sync.ts # CLI sync script
376
- └── github-action.yml # CI sync on push
377
- ```
378
-
379
- ### AI Content Pipelines (`skills/content-pipelines/`)
380
-
381
- Build intelligent, memory-powered AI systems that follow a 10-step agentic loop: **Observe → Remember → Recall → Reason → Plan → Decide → Generate → Act → Update → Repeat**. Includes ready-to-run recipe scripts for product intelligence memorization, smart notifications, web page personalization, cold outreach, and more — plus channel delivery templates for SendGrid, Slack, Twilio, and generic webhooks.
382
-
383
- ```
384
- skills/content-pipelines/
385
- ├── CLAUDE.md # Main skill instructions (10-step loop)
386
- ├── recipes/
387
- │ ├── product-intelligence.ts # Memorize everything: usage, ML, searches, content, uploads, telemetry
388
- │ ├── smart-notification.ts # Uniquely personalized alerts via smartDigest
389
- │ ├── web-personalization.ts # AI generates UI variable values for personalized web pages
390
- │ ├── cold-outreach-sequence.ts # 3-email cold outreach with sequence tracking
391
- │ ├── meeting-prep-brief.ts # On-demand meeting prep brief generator
392
- │ ├── product-usage-alert.ts # Usage monitoring + smart alerts
393
- │ ├── health-check-message.ts # Customer health assessment + check-in
394
- │ └── batch-pipeline.ts # Configurable generic batch pipeline
395
- └── channels/
396
- ├── sendgrid.md # Email delivery (SendGrid, SES, Resend)
397
- ├── slack.md # Slack webhooks + Web API
398
- ├── twilio.md # SMS + WhatsApp via Twilio
399
- └── webhook.md # Generic HTTP POST (in-app, CRM, Zapier)
351
+ ```bash
352
+ npx skills add personizeai/personize-skills --all
400
353
  ```
401
354
 
402
- ### n8n Workflow Builder (`skills/n8n-workflows/`)
403
-
404
- Generate importable n8n workflow JSON files that sync data between Personize and 400+ apps — no code required. Supports batch sync in (source → Personize), sync out (Personize → destination), webhook-triggered real-time ingestion, and per-record AI enrichment.
405
-
406
- ```
407
- skills/n8n-workflows/
408
- ├── CLAUDE.md # Main skill instructions
409
- └── templates/
410
- ├── hubspot-to-personize.json # HubSpot contacts → Personize
411
- ├── gsheets-to-personize.json # Google Sheets → Personize
412
- ├── webhook-to-personize.json # Webhook → Personize (real-time)
413
- └── personize-to-slack.json # Personize → Slack digest
414
- ```
355
+ See [personizeai/personize-skills](https://github.com/personizeai/personize-skills) for the full catalog.
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { PersonizeConfig, ApiResponse, MeResponse, TestResponse, ListOptions, VariablesResponse, VariableSectionOptions, VariableUpdatePayload, VariableCreatePayload, VariableHistoryResponse, VariableHistoryOptions, CollectionsResponse, CollectionCreatePayload, CollectionUpdatePayload, CollectionHistoryOptions, CollectionHistoryResponse, SmartContextOptions, SmartContextResponse, PromptOptions, PromptResponse, AgentRunOptions, AgentResponse, MemorizeOptions, SmartRecallOptions, RecallOptions, SearchOptions, SearchResponse, UpsertOptions, UpsertBatchOptions, BatchMemorizeOptions, SmartDigestOptions, SmartDigestResponse, EvaluateMemorizationOptions, EvaluateMemorizationResponse } from './types';
1
+ import { PersonizeConfig, ApiResponse, MeResponse, TestResponse, ListOptions, GuidelinesResponse, GuidelineSectionOptions, GuidelineUpdatePayload, GuidelineCreatePayload, GuidelineHistoryResponse, GuidelineHistoryOptions, CollectionsResponse, CollectionCreatePayload, CollectionUpdatePayload, CollectionHistoryOptions, CollectionHistoryResponse, SmartGuidelinesOptions, SmartGuidelinesResponse, PromptOptions, PromptResponse, AgentRunOptions, AgentResponse, MemorizeOptions, SmartRecallOptions, RecallOptions, SearchOptions, SearchResponse, UpsertOptions, UpsertBatchOptions, BatchMemorizeOptions, SmartDigestOptions, SmartDigestResponse, EvaluateMemorizationOptions, EvaluateMemorizationResponse } from './types';
2
2
  export declare class Personize {
3
3
  private client;
4
4
  private _organizationId?;
@@ -16,36 +16,36 @@ export declare class Personize {
16
16
  * GET /api/v1/me — Current context (org, user, plan)
17
17
  */
18
18
  me(): Promise<ApiResponse<MeResponse>>;
19
- variables: {
19
+ guidelines: {
20
20
  /**
21
- * GET /api/v1/variables — List variables for the organization (paginated).
21
+ * GET /api/v1/guidelines — List guidelines for the organization (paginated).
22
22
  * Pass `limit` and `nextToken` for cursor-based pagination.
23
23
  */
24
- list: (options?: ListOptions) => Promise<ApiResponse<VariablesResponse>>;
24
+ list: (options?: ListOptions) => Promise<ApiResponse<GuidelinesResponse>>;
25
25
  /**
26
- * GET /api/v1/variables/:id/structure — Get variable headings
26
+ * GET /api/v1/guidelines/:id/structure — Get guideline headings
27
27
  */
28
28
  getStructure: (id: string) => Promise<ApiResponse>;
29
29
  /**
30
- * GET /api/v1/variables/:id/section — Get a section of a variable by header
30
+ * GET /api/v1/guidelines/:id/section — Get a section of a guideline by header
31
31
  */
32
- getSection: (id: string, options: VariableSectionOptions) => Promise<ApiResponse>;
32
+ getSection: (id: string, options: GuidelineSectionOptions) => Promise<ApiResponse>;
33
33
  /**
34
- * PATCH /api/v1/variables/:id — Partial update to a variable
34
+ * PATCH /api/v1/guidelines/:id — Partial update to a guideline
35
35
  */
36
- update: (id: string, payload: VariableUpdatePayload) => Promise<ApiResponse>;
36
+ update: (id: string, payload: GuidelineUpdatePayload) => Promise<ApiResponse>;
37
37
  /**
38
- * POST /api/v1/variables — Create a new variable
38
+ * POST /api/v1/guidelines — Create a new guideline
39
39
  */
40
- create: (payload: VariableCreatePayload) => Promise<ApiResponse>;
40
+ create: (payload: GuidelineCreatePayload) => Promise<ApiResponse>;
41
41
  /**
42
- * DELETE /api/v1/variables/:id — Delete a variable
42
+ * DELETE /api/v1/guidelines/:id — Delete a guideline
43
43
  */
44
44
  delete: (id: string) => Promise<ApiResponse>;
45
45
  /**
46
- * GET /api/v1/actions/:id/history — Get version history for a variable
46
+ * GET /api/v1/actions/:id/history — Get version history for a guideline
47
47
  */
48
- history: (id: string, options?: VariableHistoryOptions) => Promise<ApiResponse<VariableHistoryResponse>>;
48
+ history: (id: string, options?: GuidelineHistoryOptions) => Promise<ApiResponse<GuidelineHistoryResponse>>;
49
49
  };
50
50
  collections: {
51
51
  /**
@@ -73,9 +73,9 @@ export declare class Personize {
73
73
  };
74
74
  ai: {
75
75
  /**
76
- * POST /api/v1/ai/smart-contextSemantic context routing
76
+ * POST /api/v1/ai/smart-guidelinesSmart guidelines routing. Selects relevant organizational guidelines for a task.
77
77
  */
78
- smartContext: (options: SmartContextOptions) => Promise<ApiResponse<SmartContextResponse>>;
78
+ smartGuidelines: (options: SmartGuidelinesOptions) => Promise<ApiResponse<SmartGuidelinesResponse>>;
79
79
  /**
80
80
  * POST /api/v1/prompt — Execute a prompt with tools, output extraction, and evaluation.
81
81
  *
package/dist/client.js CHANGED
@@ -8,9 +8,9 @@ const axios_1 = __importDefault(require("axios"));
8
8
  const errors_1 = require("./errors");
9
9
  class Personize {
10
10
  constructor(config) {
11
- this.variables = {
11
+ this.guidelines = {
12
12
  /**
13
- * GET /api/v1/variables — List variables for the organization (paginated).
13
+ * GET /api/v1/guidelines — List guidelines for the organization (paginated).
14
14
  * Pass `limit` and `nextToken` for cursor-based pagination.
15
15
  */
16
16
  list: async (options) => {
@@ -25,32 +25,32 @@ class Personize {
25
25
  params.tags = Array.isArray(options.tags) ? options.tags.join(',') : options.tags;
26
26
  if (options?.excludeTags)
27
27
  params.excludeTags = Array.isArray(options.excludeTags) ? options.excludeTags.join(',') : options.excludeTags;
28
- const response = await this.client.get('/api/v1/variables', { params });
28
+ const response = await this.client.get('/api/v1/guidelines', { params });
29
29
  return response.data;
30
30
  },
31
31
  /**
32
- * GET /api/v1/variables/:id/structure — Get variable headings
32
+ * GET /api/v1/guidelines/:id/structure — Get guideline headings
33
33
  */
34
34
  getStructure: async (id) => {
35
- const response = await this.client.get(`/api/v1/variables/${id}/structure`);
35
+ const response = await this.client.get(`/api/v1/guidelines/${id}/structure`);
36
36
  return response.data;
37
37
  },
38
38
  /**
39
- * GET /api/v1/variables/:id/section — Get a section of a variable by header
39
+ * GET /api/v1/guidelines/:id/section — Get a section of a guideline by header
40
40
  */
41
41
  getSection: async (id, options) => {
42
- const response = await this.client.get(`/api/v1/variables/${id}/section`, {
42
+ const response = await this.client.get(`/api/v1/guidelines/${id}/section`, {
43
43
  params: { header: options.header },
44
44
  });
45
45
  return response.data;
46
46
  },
47
47
  /**
48
- * PATCH /api/v1/variables/:id — Partial update to a variable
48
+ * PATCH /api/v1/guidelines/:id — Partial update to a guideline
49
49
  */
50
50
  update: async (id, payload) => {
51
51
  const organizationId = await this.getOrganizationId();
52
52
  const { historyNote, ...rest } = payload;
53
- const response = await this.client.patch(`/api/v1/variables/${id}`, {
53
+ const response = await this.client.patch(`/api/v1/guidelines/${id}`, {
54
54
  organizationId,
55
55
  historyNote,
56
56
  payload: rest,
@@ -58,21 +58,21 @@ class Personize {
58
58
  return response.data;
59
59
  },
60
60
  /**
61
- * POST /api/v1/variables — Create a new variable
61
+ * POST /api/v1/guidelines — Create a new guideline
62
62
  */
63
63
  create: async (payload) => {
64
- const response = await this.client.post('/api/v1/variables', payload);
64
+ const response = await this.client.post('/api/v1/guidelines', payload);
65
65
  return response.data;
66
66
  },
67
67
  /**
68
- * DELETE /api/v1/variables/:id — Delete a variable
68
+ * DELETE /api/v1/guidelines/:id — Delete a guideline
69
69
  */
70
70
  delete: async (id) => {
71
- const response = await this.client.delete(`/api/v1/variables/${id}`);
71
+ const response = await this.client.delete(`/api/v1/guidelines/${id}`);
72
72
  return response.data;
73
73
  },
74
74
  /**
75
- * GET /api/v1/actions/:id/history — Get version history for a variable
75
+ * GET /api/v1/actions/:id/history — Get version history for a guideline
76
76
  */
77
77
  history: async (id, options) => {
78
78
  const organizationId = await this.getOrganizationId();
@@ -141,10 +141,10 @@ class Personize {
141
141
  };
142
142
  this.ai = {
143
143
  /**
144
- * POST /api/v1/ai/smart-contextSemantic context routing
144
+ * POST /api/v1/ai/smart-guidelinesSmart guidelines routing. Selects relevant organizational guidelines for a task.
145
145
  */
146
- smartContext: async (options) => {
147
- const response = await this.client.post('/api/v1/ai/smart-context', options);
146
+ smartGuidelines: async (options) => {
147
+ const response = await this.client.post('/api/v1/ai/smart-guidelines', options);
148
148
  return response.data;
149
149
  },
150
150
  /**
@@ -285,7 +285,7 @@ class Personize {
285
285
  this.maxRetries = config.maxRetries ?? 3;
286
286
  this.retryDelay = config.retryDelay ?? 1000;
287
287
  this.client = axios_1.default.create({
288
- baseURL: config.baseURL || 'https://api.personize.ai',
288
+ baseURL: config.baseURL || 'https://agent.personize.ai',
289
289
  timeout: config.timeout ?? 30000,
290
290
  headers: {
291
291
  'Authorization': `Bearer ${config.secretKey}`,
package/dist/types.d.ts CHANGED
@@ -58,24 +58,37 @@ export interface ListOptions {
58
58
  /** When true, strip the full `value` field for lighter payloads. */
59
59
  summary?: boolean;
60
60
  }
61
- export interface VariablesResponse {
61
+ /** Inferred governance scope for a guideline — determines when it is proactively included in SmartContext results. */
62
+ export interface GovernanceScope {
63
+ /** True if this guideline applies to virtually all agent tasks (e.g., core company values, universal compliance). */
64
+ alwaysOn: boolean;
65
+ /** Action/domain keywords that trigger inclusion (e.g., "email", "pricing", "deploy"). */
66
+ triggerKeywords: string[];
67
+ }
68
+ export interface GuidelinesResponse {
62
69
  actions: Array<{
63
70
  id: string;
64
71
  type: string;
65
72
  payload: {
66
73
  name: string;
67
74
  value: string;
68
- [key: string]: PropertyValue;
75
+ /** Auto-inferred governance scope (read-only). Present when the guideline has been analyzed. */
76
+ governanceScope?: GovernanceScope;
77
+ [key: string]: PropertyValue | GovernanceScope | string[] | undefined;
69
78
  };
70
79
  }>;
71
80
  count: number;
72
81
  /** Cursor for the next page. Undefined when on the last page. */
73
82
  nextToken?: string;
74
83
  }
75
- export interface VariableSectionOptions {
84
+ /** @deprecated Use GuidelinesResponse instead. */
85
+ export type VariablesResponse = GuidelinesResponse;
86
+ export interface GuidelineSectionOptions {
76
87
  header: string;
77
88
  }
78
- export interface VariableUpdatePayload {
89
+ /** @deprecated Use GuidelineSectionOptions instead. */
90
+ export type VariableSectionOptions = GuidelineSectionOptions;
91
+ export interface GuidelineUpdatePayload {
79
92
  name?: string;
80
93
  value?: string;
81
94
  description?: string;
@@ -86,14 +99,18 @@ export interface VariableUpdatePayload {
86
99
  separator?: string;
87
100
  historyNote?: string;
88
101
  }
89
- export interface VariableCreatePayload {
102
+ /** @deprecated Use GuidelineUpdatePayload instead. */
103
+ export type VariableUpdatePayload = GuidelineUpdatePayload;
104
+ export interface GuidelineCreatePayload {
90
105
  name: string;
91
106
  value?: string;
92
107
  description?: string;
93
108
  tags?: string[];
94
109
  secure?: boolean;
95
110
  }
96
- export interface VariableHistoryEntry {
111
+ /** @deprecated Use GuidelineCreatePayload instead. */
112
+ export type VariableCreatePayload = GuidelineCreatePayload;
113
+ export interface GuidelineHistoryEntry {
97
114
  id: string;
98
115
  originalActionId: string;
99
116
  type: string;
@@ -109,16 +126,22 @@ export interface VariableHistoryEntry {
109
126
  [key: string]: PropertyValue;
110
127
  };
111
128
  }
112
- export interface VariableHistoryResponse {
129
+ /** @deprecated Use GuidelineHistoryEntry instead. */
130
+ export type VariableHistoryEntry = GuidelineHistoryEntry;
131
+ export interface GuidelineHistoryResponse {
113
132
  actionId: string;
114
- history: VariableHistoryEntry[];
133
+ history: GuidelineHistoryEntry[];
115
134
  count: number;
116
135
  }
117
- export interface VariableHistoryOptions {
136
+ /** @deprecated Use GuidelineHistoryResponse instead. */
137
+ export type VariableHistoryResponse = GuidelineHistoryResponse;
138
+ export interface GuidelineHistoryOptions {
118
139
  /** Max number of history records to return (default: 20, max: 50).
119
140
  * Each entry includes the full variable content snapshot, so use a small limit (3-5) in token-sensitive contexts. */
120
141
  limit?: number;
121
142
  }
143
+ /** @deprecated Use GuidelineHistoryOptions instead. */
144
+ export type VariableHistoryOptions = GuidelineHistoryOptions;
122
145
  export interface CollectionsResponse {
123
146
  actions: Array<{
124
147
  id: string;
@@ -213,9 +236,12 @@ export interface CollectionHistoryResponse {
213
236
  changes: CollectionPropertyDiff;
214
237
  }>;
215
238
  }
216
- export interface SmartContextOptions {
239
+ export interface SmartGuidelinesOptions {
217
240
  message: string;
218
- variableIds?: string[];
241
+ /** Filter to specific guideline IDs. */
242
+ guidelineIds?: string[];
243
+ /** Resolve guideline names to IDs server-side (case-insensitive match). */
244
+ guidelineNames?: string[];
219
245
  tags?: string[];
220
246
  excludeTags?: string[];
221
247
  model?: string;
@@ -226,13 +252,17 @@ export interface SmartContextOptions {
226
252
  /** Session ID for conversation continuity. */
227
253
  sessionId?: string;
228
254
  }
229
- export interface SmartContextAnalysis {
255
+ /** @deprecated Use SmartGuidelinesOptions instead. */
256
+ export type SmartContextOptions = SmartGuidelinesOptions;
257
+ export interface SmartGuidelinesAnalysis {
230
258
  taskUnderstanding: string;
231
259
  qualityDimensions: string[];
232
260
  refinedTask: string;
233
261
  }
234
- export interface SmartContextSelection {
235
- variableId: string;
262
+ /** @deprecated Use SmartGuidelinesAnalysis instead. */
263
+ export type SmartContextAnalysis = SmartGuidelinesAnalysis;
264
+ export interface SmartGuidelinesSelection {
265
+ guidelineId: string;
236
266
  name?: string;
237
267
  score?: number;
238
268
  reason?: string;
@@ -242,10 +272,12 @@ export interface SmartContextSelection {
242
272
  mode?: string;
243
273
  sections?: string[];
244
274
  }
245
- export interface SmartContextUsage {
275
+ /** @deprecated Use SmartGuidelinesSelection instead. */
276
+ export type SmartContextSelection = SmartGuidelinesSelection;
277
+ export interface SmartGuidelinesUsage {
246
278
  durationMs: number;
247
279
  tokensUsed?: number;
248
- variablesScanned?: number;
280
+ guidelinesScanned?: number;
249
281
  selectedCount?: number;
250
282
  preFilter?: {
251
283
  total: number;
@@ -254,17 +286,21 @@ export interface SmartContextUsage {
254
286
  durationMs: number;
255
287
  };
256
288
  }
257
- export interface SmartContextResponse {
289
+ /** @deprecated Use SmartGuidelinesUsage instead. */
290
+ export type SmartContextUsage = SmartGuidelinesUsage;
291
+ export interface SmartGuidelinesResponse {
258
292
  success: boolean;
259
293
  /** Which routing mode was actually used. */
260
294
  mode: 'fast' | 'full';
261
295
  /** LLM analysis of the task. Null in fast mode. */
262
- analysis?: SmartContextAnalysis | null;
263
- selection: SmartContextSelection[];
264
- supplementary?: SmartContextSelection[];
296
+ analysis?: SmartGuidelinesAnalysis | null;
297
+ selection: SmartGuidelinesSelection[];
298
+ supplementary?: SmartGuidelinesSelection[];
265
299
  compiledContext: string;
266
- usage: SmartContextUsage;
300
+ usage: SmartGuidelinesUsage;
267
301
  }
302
+ /** @deprecated Use SmartGuidelinesResponse instead. */
303
+ export type SmartContextResponse = SmartGuidelinesResponse;
268
304
  /**
269
305
  * Per-MCP tool selection override.
270
306
  * Use enabledTools for an explicit allowlist, or disabledTools for a denylist.
@@ -274,6 +310,38 @@ export interface McpToolSelection {
274
310
  enabledTools?: string[];
275
311
  disabledTools?: string[];
276
312
  }
313
+ /**
314
+ * An attachment sent alongside a prompt or agent run.
315
+ *
316
+ * Two modes:
317
+ * - **Inline (base64):** `data` contains the raw base64-encoded content.
318
+ * - **URL reference:** `url` points to a publicly-accessible or presigned URL.
319
+ *
320
+ * At least one of `data` or `url` must be provided.
321
+ */
322
+ export interface Attachment {
323
+ /** Human-readable filename (e.g. "screenshot.png"). Max 255 chars. */
324
+ name?: string;
325
+ /** MIME type (e.g. "image/png", "application/pdf"). Must be a supported type. */
326
+ mimeType: string;
327
+ /** Base64-encoded content. Required if `url` is not provided. */
328
+ data?: string;
329
+ /** Publicly-accessible URL to the content. Required if `data` is not provided. */
330
+ url?: string;
331
+ }
332
+ /**
333
+ * Supported MIME types for attachments.
334
+ *
335
+ * Images: image/png, image/jpeg, image/gif, image/webp, image/svg+xml
336
+ * Documents: application/pdf, text/plain, text/csv, text/html, text/markdown, application/json
337
+ */
338
+ export declare const SUPPORTED_ATTACHMENT_TYPES: readonly ["image/png", "image/jpeg", "image/gif", "image/webp", "image/svg+xml", "application/pdf", "text/plain", "text/csv", "text/html", "text/markdown", "application/json"];
339
+ /** Max attachments per request. */
340
+ export declare const MAX_ATTACHMENTS_COUNT = 10;
341
+ /** Max size per attachment in bytes (20 MB). */
342
+ export declare const MAX_ATTACHMENT_SIZE_BYTES: number;
343
+ /** Max total attachment payload in bytes (50 MB). */
344
+ export declare const MAX_TOTAL_ATTACHMENTS_BYTES: number;
277
345
  /** Auto-memorize configuration for /prompt. */
278
346
  export interface PromptMemorizeConfig {
279
347
  /** Contact email identifier. */
@@ -286,7 +354,7 @@ export interface PromptMemorizeConfig {
286
354
  type?: 'Contact' | 'Company' | 'User';
287
355
  /**
288
356
  * When true, tool results from research tools (search_companies, tavily, etc.)
289
- * are automatically captured and memorized. Meta tools (smart_context,
357
+ * are automatically captured and memorized. Meta tools (smart_guidelines,
290
358
  * recall_pro, memorize_pro, store_evaluation_log) are excluded.
291
359
  */
292
360
  captureToolResults?: boolean;
@@ -443,6 +511,12 @@ export interface AgentRunOptions {
443
511
  recordId?: string;
444
512
  /** Per-MCP tool selection override (allowlist or denylist per MCP) */
445
513
  mcpTools?: McpToolSelection[];
514
+ /**
515
+ * Images or documents to send with the agent run (multimodal input).
516
+ *
517
+ * Limits: max 10 attachments, 20 MB each, 50 MB total.
518
+ */
519
+ attachments?: Attachment[];
446
520
  }
447
521
  export interface MemorizeOptions {
448
522
  /** Content to memorize. */
@@ -493,6 +567,10 @@ export interface SmartRecallOptions {
493
567
  website_url?: string;
494
568
  /** Entity type filter (e.g. 'Contact', 'Company'). */
495
569
  type?: string;
570
+ /** Scope results to specific collections by ID. */
571
+ collectionIds?: string[];
572
+ /** Scope results to specific collections by name (resolved server-side, case-insensitive). */
573
+ collectionNames?: string[];
496
574
  /** Return schema-enforced property values separately from free-form memories. */
497
575
  include_property_values?: boolean;
498
576
  /** Enable reflection loop to improve recall coverage (default: true). */
package/dist/types.js CHANGED
@@ -1,3 +1,22 @@
1
1
  "use strict";
2
2
  // --- Utility Types ---
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.MAX_TOTAL_ATTACHMENTS_BYTES = exports.MAX_ATTACHMENT_SIZE_BYTES = exports.MAX_ATTACHMENTS_COUNT = exports.SUPPORTED_ATTACHMENT_TYPES = void 0;
5
+ /**
6
+ * Supported MIME types for attachments.
7
+ *
8
+ * Images: image/png, image/jpeg, image/gif, image/webp, image/svg+xml
9
+ * Documents: application/pdf, text/plain, text/csv, text/html, text/markdown, application/json
10
+ */
11
+ exports.SUPPORTED_ATTACHMENT_TYPES = [
12
+ 'image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/svg+xml',
13
+ 'application/pdf',
14
+ 'text/plain', 'text/csv', 'text/html', 'text/markdown',
15
+ 'application/json',
16
+ ];
17
+ /** Max attachments per request. */
18
+ exports.MAX_ATTACHMENTS_COUNT = 10;
19
+ /** Max size per attachment in bytes (20 MB). */
20
+ exports.MAX_ATTACHMENT_SIZE_BYTES = 20 * 1024 * 1024;
21
+ /** Max total attachment payload in bytes (50 MB). */
22
+ exports.MAX_TOTAL_ATTACHMENTS_BYTES = 50 * 1024 * 1024;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@personize/sdk",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Official Personize SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,11 +18,11 @@
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "https://github.com/hataheri/personize-sdk.git"
21
+ "url": "https://github.com/personizeai/personize-sdk.git"
22
22
  },
23
23
  "homepage": "https://personize.ai",
24
24
  "bugs": {
25
- "url": "https://github.com/hataheri/personize-sdk/issues"
25
+ "url": "https://github.com/personizeai/personize-sdk/issues"
26
26
  },
27
27
  "keywords": [
28
28
  "personize",