@deepagents/context 0.11.0 → 0.12.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/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +618 -153
- package/dist/index.js.map +4 -4
- package/dist/lib/agent.d.ts +7 -6
- package/dist/lib/agent.d.ts.map +1 -1
- package/dist/lib/engine.d.ts +25 -5
- package/dist/lib/engine.d.ts.map +1 -1
- package/dist/lib/fragments/domain.d.ts +98 -1
- package/dist/lib/fragments/domain.d.ts.map +1 -1
- package/dist/lib/fragments/user.d.ts +8 -8
- package/dist/lib/fragments/user.d.ts.map +1 -1
- package/dist/lib/fragments.d.ts +46 -6
- package/dist/lib/fragments.d.ts.map +1 -1
- package/dist/lib/guardrails/error-recovery.guardrail.d.ts +3 -0
- package/dist/lib/guardrails/error-recovery.guardrail.d.ts.map +1 -0
- package/dist/lib/render.d.ts +21 -0
- package/dist/lib/render.d.ts.map +1 -0
- package/dist/lib/renderers/abstract.renderer.d.ts +10 -2
- package/dist/lib/renderers/abstract.renderer.d.ts.map +1 -1
- package/dist/lib/sandbox/binary-bridges.d.ts.map +1 -1
- package/dist/lib/skills/fragments.d.ts +7 -3
- package/dist/lib/skills/fragments.d.ts.map +1 -1
- package/dist/lib/skills/index.d.ts +9 -4
- package/dist/lib/skills/index.d.ts.map +1 -1
- package/dist/lib/skills/loader.d.ts.map +1 -1
- package/dist/lib/skills/types.d.ts +24 -2
- package/dist/lib/skills/types.d.ts.map +1 -1
- package/dist/lib/store/sqlite.store.d.ts +4 -2
- package/dist/lib/store/sqlite.store.d.ts.map +1 -1
- package/dist/lib/store/store.d.ts +36 -2
- package/dist/lib/store/store.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/lib/agent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type StreamTextResult, type StreamTextTransform, type ToolChoice, type ToolSet, generateText } from 'ai';
|
|
1
|
+
import { type GenerateTextResult, Output, type StreamTextResult, type StreamTextTransform, type ToolChoice, type ToolSet, generateText } from 'ai';
|
|
2
2
|
import z from 'zod';
|
|
3
3
|
import { type AgentModel } from '@deepagents/agent';
|
|
4
4
|
import { type ContextEngine } from '../index.ts';
|
|
@@ -27,7 +27,7 @@ declare class Agent<CIn, COut = CIn> {
|
|
|
27
27
|
constructor(options: CreateAgent<CIn, COut>);
|
|
28
28
|
generate<COut, CIn = COut>(contextVariables: CIn, config?: {
|
|
29
29
|
abortSignal?: AbortSignal;
|
|
30
|
-
}): Promise<
|
|
30
|
+
}): Promise<GenerateTextResult<ToolSet, Output.Output<string, string, any>>>;
|
|
31
31
|
/**
|
|
32
32
|
* Stream a response from the agent.
|
|
33
33
|
*
|
|
@@ -57,11 +57,11 @@ export declare function agent<CIn, COut = CIn>(options: CreateAgent<CIn, COut>):
|
|
|
57
57
|
* Options for creating a structured output handler.
|
|
58
58
|
*/
|
|
59
59
|
export interface StructuredOutputOptions<TSchema extends z.ZodType> {
|
|
60
|
-
name: string;
|
|
61
60
|
context?: ContextEngine;
|
|
62
61
|
model?: AgentModel;
|
|
63
62
|
schema: TSchema;
|
|
64
63
|
providerOptions?: Parameters<typeof generateText>[0]['providerOptions'];
|
|
64
|
+
tools?: ToolSet;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Create a structured output handler that provides simplified access to structured output.
|
|
@@ -89,14 +89,15 @@ export interface StructuredOutputOptions<TSchema extends z.ZodType> {
|
|
|
89
89
|
* const stream = await output.stream({});
|
|
90
90
|
* ```
|
|
91
91
|
*/
|
|
92
|
-
export
|
|
92
|
+
export interface StructuredOutputResult<TSchema extends z.ZodType> {
|
|
93
93
|
generate<CIn>(contextVariables?: CIn, config?: {
|
|
94
94
|
abortSignal?: AbortSignal;
|
|
95
95
|
}): Promise<z.infer<TSchema>>;
|
|
96
96
|
stream<CIn>(contextVariables?: CIn, config?: {
|
|
97
97
|
abortSignal?: AbortSignal;
|
|
98
98
|
transform?: StreamTextTransform<ToolSet> | StreamTextTransform<ToolSet>[];
|
|
99
|
-
}): Promise<StreamTextResult<ToolSet,
|
|
100
|
-
}
|
|
99
|
+
}): Promise<StreamTextResult<ToolSet, any>>;
|
|
100
|
+
}
|
|
101
|
+
export declare function structuredOutput<TSchema extends z.ZodType>(options: StructuredOutputOptions<TSchema>): StructuredOutputResult<TSchema>;
|
|
101
102
|
export {};
|
|
102
103
|
//# sourceMappingURL=agent.d.ts.map
|
package/dist/lib/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/lib/agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/lib/agent.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EAEvB,MAAM,EACN,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EAExB,KAAK,UAAU,EACf,KAAK,OAAO,EAKZ,YAAY,EAIb,MAAM,IAAI,CAAC;AAEZ,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,KAAK,aAAa,EAAe,MAAM,aAAa,CAAC;AAE9D,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,WAAW,CAAC,GAAG,EAAE,IAAI,GAAG,GAAG;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,UAAU,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,eAAe,CAAC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAA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E,IAAI,CAAC,CAElB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO;IAChE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACxE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,sBAAsB,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO;IAC/D,QAAQ,CAAC,GAAG,EACV,gBAAgB,CAAC,EAAE,GAAG,EACtB,MAAM,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,WAAW,CAAA;KAAE,GACrC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7B,MAAM,CAAC,GAAG,EACR,gBAAgB,CAAC,EAAE,GAAG,EACtB,MAAM,CAAC,EAAE;QACP,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,SAAS,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,GAAG,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;KAC3E,GACA,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;CAC5C;AAED,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO,EACxD,OAAO,EAAE,uBAAuB,CAAC,OAAO,CAAC,GACxC,sBAAsB,CAAC,OAAO,CAAC,CAoEjC"}
|
package/dist/lib/engine.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type EstimateResult } from './estimate.ts';
|
|
|
2
2
|
import type { ContextFragment } from './fragments.ts';
|
|
3
3
|
import type { Models } from './models.generated.ts';
|
|
4
4
|
import { type ContextRenderer } from './renderers/abstract.renderer.ts';
|
|
5
|
+
import type { SkillPathMapping } from './skills/types.ts';
|
|
5
6
|
import { type BranchInfo, type CheckpointInfo, ContextStore, type GraphData, type MessageData } from './store/store.ts';
|
|
6
7
|
/**
|
|
7
8
|
* Result of resolving context - ready for AI SDK consumption.
|
|
@@ -27,8 +28,8 @@ export interface ContextEngineOptions {
|
|
|
27
28
|
store: ContextStore;
|
|
28
29
|
/** Unique identifier for this chat (required) */
|
|
29
30
|
chatId: string;
|
|
30
|
-
/**
|
|
31
|
-
|
|
31
|
+
/** User who owns this chat (required) */
|
|
32
|
+
userId: string;
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
34
35
|
* Metadata about a chat.
|
|
@@ -36,6 +37,8 @@ export interface ContextEngineOptions {
|
|
|
36
37
|
export interface ChatMeta {
|
|
37
38
|
/** Unique chat identifier */
|
|
38
39
|
id: string;
|
|
40
|
+
/** User who owns this chat */
|
|
41
|
+
userId: string;
|
|
39
42
|
/** When the chat was created */
|
|
40
43
|
createdAt: number;
|
|
41
44
|
/** When the chat was last updated */
|
|
@@ -56,7 +59,7 @@ export interface InspectOptions {
|
|
|
56
59
|
}
|
|
57
60
|
/**
|
|
58
61
|
* Result of inspecting context state.
|
|
59
|
-
*
|
|
62
|
+
* JSON-serializable snapshot for debugging.
|
|
60
63
|
*/
|
|
61
64
|
export interface InspectResult {
|
|
62
65
|
/** Token usage and cost estimation */
|
|
@@ -129,7 +132,7 @@ export declare class ContextEngine {
|
|
|
129
132
|
*
|
|
130
133
|
* @example
|
|
131
134
|
* ```ts
|
|
132
|
-
* const context = new ContextEngine({ store, chatId: 'chat-1' })
|
|
135
|
+
* const context = new ContextEngine({ store, chatId: 'chat-1', userId: 'user-1' })
|
|
133
136
|
* .set(role('You are helpful'), user('Hello'));
|
|
134
137
|
*
|
|
135
138
|
* const { systemPrompt, messages } = await context.resolve();
|
|
@@ -299,9 +302,26 @@ export declare class ContextEngine {
|
|
|
299
302
|
* @experimental
|
|
300
303
|
*/
|
|
301
304
|
consolidate(): void;
|
|
305
|
+
/**
|
|
306
|
+
* Extract skill path mappings from available_skills fragments.
|
|
307
|
+
* Returns array of { host, sandbox } for mounting in sandbox filesystem.
|
|
308
|
+
*
|
|
309
|
+
* Reads the original `paths` configuration stored in fragment metadata
|
|
310
|
+
* by the skills() fragment helper.
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```ts
|
|
314
|
+
* const context = new ContextEngine({ store, chatId, userId })
|
|
315
|
+
* .set(skills({ paths: [{ host: './skills', sandbox: '/skills' }] }));
|
|
316
|
+
*
|
|
317
|
+
* const mounts = context.getSkillMounts();
|
|
318
|
+
* // [{ host: './skills', sandbox: '/skills' }]
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
321
|
+
getSkillMounts(): SkillPathMapping[];
|
|
302
322
|
/**
|
|
303
323
|
* Inspect the full context state for debugging.
|
|
304
|
-
* Returns a
|
|
324
|
+
* Returns a JSON-serializable object with context information.
|
|
305
325
|
*
|
|
306
326
|
* @param options - Inspection options (modelId and renderer required)
|
|
307
327
|
* @returns Complete inspection data including estimates, rendered output, fragments, and graph
|
package/dist/lib/engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/lib/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/lib/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,gBAAgB,CAAC;AAQpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,kCAAkC,CAA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GAAG,OAAO,CAAC,cAAc,CAAC;IAyB9D;;;;;;;;;;;;;;;OAeG;IACU,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAcvD;;;;;;;;;;;;;;OAcG;IACU,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACU,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC;IAUvC;;;;;;;;;;;;OAYG;IACU,UAAU,CACrB,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC,GACrD,OAAO,CAAC,IAAI,CAAC;IAmBhB;;;;;;;OAOG;IACI,WAAW,IAAI,IAAI;IAI1B;;;;;;;;;;;;;;;OAeG;IACI,cAAc,IAAI,gBAAgB,EAAE;IAyB3C;;;;;;;;;;;;;;;;;;OAkBG;IACU,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAuCtE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContextFragment } from '../fragments.ts';
|
|
1
|
+
import type { ContextFragment, FragmentData } from '../fragments.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Domain knowledge fragment builders.
|
|
4
4
|
*
|
|
@@ -437,4 +437,101 @@ export declare function analogy(input: {
|
|
|
437
437
|
* })
|
|
438
438
|
*/
|
|
439
439
|
export declare function glossary(entries: Record<string, string>): ContextFragment;
|
|
440
|
+
/**
|
|
441
|
+
* Create a role fragment for system prompt instructions.
|
|
442
|
+
*/
|
|
443
|
+
export declare function role(content: string): ContextFragment;
|
|
444
|
+
/**
|
|
445
|
+
* Define a guiding principle that shapes agent behavior.
|
|
446
|
+
*
|
|
447
|
+
* Use this to establish high-level rules for decision-making, reasoning, or domain behavior.
|
|
448
|
+
* Principles can contain policies (specific rules that implement the principle).
|
|
449
|
+
*
|
|
450
|
+
* @param input.title - Name/title of the principle
|
|
451
|
+
* @param input.description - What this principle means and why it matters
|
|
452
|
+
* @param input.policies - Optional specific rules that implement this principle
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* // Logical dependencies principle
|
|
456
|
+
* principle({
|
|
457
|
+
* title: "Logical dependencies and constraints",
|
|
458
|
+
* description: "Analyze intended actions against factors in order of importance",
|
|
459
|
+
* policies: [
|
|
460
|
+
* "Policy-based rules, mandatory prerequisites, and constraints",
|
|
461
|
+
* "Order of operations: Ensure actions don't prevent subsequent necessary actions",
|
|
462
|
+
* "Other prerequisites (information and/or actions needed)",
|
|
463
|
+
* "Explicit user constraints or preferences"
|
|
464
|
+
* ]
|
|
465
|
+
* })
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* // Risk assessment principle
|
|
469
|
+
* principle({
|
|
470
|
+
* title: "Risk assessment",
|
|
471
|
+
* description: "Evaluate consequences before taking action",
|
|
472
|
+
* policies: [
|
|
473
|
+
* "For exploratory tasks, missing optional parameters is LOW risk",
|
|
474
|
+
* "Prefer calling tools with available information over asking the user"
|
|
475
|
+
* ]
|
|
476
|
+
* })
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* // Design principle
|
|
480
|
+
* principle({
|
|
481
|
+
* title: "Separation of concerns",
|
|
482
|
+
* description: "Each module should have a single, well-defined responsibility",
|
|
483
|
+
* policies: [
|
|
484
|
+
* "Data access logic stays in repository layer",
|
|
485
|
+
* "Business rules stay in service layer",
|
|
486
|
+
* "Presentation logic stays in controller/view layer"
|
|
487
|
+
* ]
|
|
488
|
+
* })
|
|
489
|
+
*/
|
|
490
|
+
export declare function principle(input: {
|
|
491
|
+
title: string;
|
|
492
|
+
description: string;
|
|
493
|
+
policies?: FragmentData[];
|
|
494
|
+
}): ContextFragment;
|
|
495
|
+
/**
|
|
496
|
+
* Define a policy rule, optionally with prerequisites or nested sub-policies.
|
|
497
|
+
*
|
|
498
|
+
* Policies can be used in two ways:
|
|
499
|
+
* 1. Prerequisite rules: "must do X before Y" using the `before` parameter
|
|
500
|
+
* 2. Sub-policies: nested rules within a principle using the `policies` parameter
|
|
501
|
+
*
|
|
502
|
+
* Policies differ from guardrails: policies are prerequisites (do this first),
|
|
503
|
+
* guardrails are prohibitions (never do this).
|
|
504
|
+
*
|
|
505
|
+
* @param input.rule - The policy rule to enforce
|
|
506
|
+
* @param input.before - What action this is a prerequisite for (optional for sub-policies)
|
|
507
|
+
* @param input.reason - Why this rule matters
|
|
508
|
+
* @param input.policies - Nested sub-policies for hierarchical structure
|
|
509
|
+
*
|
|
510
|
+
* @example
|
|
511
|
+
* // Prerequisite rule with "before"
|
|
512
|
+
* policy({
|
|
513
|
+
* rule: "Validate SQL syntax",
|
|
514
|
+
* before: "executing any query against the database",
|
|
515
|
+
* reason: "Catches errors early and allows correction before execution"
|
|
516
|
+
* })
|
|
517
|
+
*
|
|
518
|
+
* @example
|
|
519
|
+
* // Sub-policy within a principle (no "before" needed)
|
|
520
|
+
* policy({ rule: "Policy-based rules, mandatory prerequisites, and constraints." })
|
|
521
|
+
*
|
|
522
|
+
* @example
|
|
523
|
+
* // Nested sub-policies (hierarchical structure like 1.2 → 1.2.1)
|
|
524
|
+
* policy({
|
|
525
|
+
* rule: "Order of operations: Ensure taking an action does not prevent a subsequent necessary action.",
|
|
526
|
+
* policies: [
|
|
527
|
+
* "The user may request actions in a random order, but you may need to reorder operations.",
|
|
528
|
+
* ],
|
|
529
|
+
* })
|
|
530
|
+
*/
|
|
531
|
+
export declare function policy(input: {
|
|
532
|
+
rule: string;
|
|
533
|
+
before?: string;
|
|
534
|
+
reason?: string;
|
|
535
|
+
policies?: FragmentData[];
|
|
536
|
+
}): ContextFragment;
|
|
440
537
|
//# sourceMappingURL=domain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../src/lib/fragments/domain.ts"],"names":[],"mappings":"AAAA,O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AAe,CAKrD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B,GAAG,eAAe,CASlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B,GAAG,eAAe,CAUlB"}
|
|
@@ -36,23 +36,23 @@ export declare function identity(input: {
|
|
|
36
36
|
role?: string;
|
|
37
37
|
}): ContextFragment;
|
|
38
38
|
/**
|
|
39
|
-
* Define an AI persona with a name, role, and communication tone.
|
|
39
|
+
* Define an AI persona with a name, role, objective, and communication tone.
|
|
40
40
|
*
|
|
41
|
-
* Use this to customize the assistant's
|
|
42
|
-
* The persona influences the style and approach of responses.
|
|
41
|
+
* Use this to customize the assistant's identity and what it should accomplish.
|
|
43
42
|
*
|
|
44
43
|
* @param input.name - The persona's name
|
|
45
|
-
* @param input.role - The persona's
|
|
44
|
+
* @param input.role - The persona's expertise/identity (what they are)
|
|
45
|
+
* @param input.objective - What the persona should accomplish (the goal)
|
|
46
46
|
* @param input.tone - The communication style (e.g., friendly, professional, concise)
|
|
47
47
|
*
|
|
48
48
|
* @example
|
|
49
|
-
* persona({ name: "DataBot", role: "SQL Expert",
|
|
50
|
-
* persona({ name: "QueryMaster", role: "Database Analyst",
|
|
51
|
-
* persona({ name: "SQLHelper", role: "Data Assistant", tone: "casual and approachable" })
|
|
49
|
+
* persona({ name: "DataBot", role: "SQL Expert", objective: "Generate accurate SQL queries from natural language" })
|
|
50
|
+
* persona({ name: "QueryMaster", role: "Database Analyst", objective: "Help users explore database schemas" })
|
|
52
51
|
*/
|
|
53
52
|
export declare function persona(input: {
|
|
54
53
|
name: string;
|
|
55
|
-
role
|
|
54
|
+
role?: string;
|
|
55
|
+
objective?: string;
|
|
56
56
|
tone?: string;
|
|
57
57
|
}): ContextFragment;
|
|
58
58
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/lib/fragments/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,eAAe,CAQlB;AAED
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/lib/fragments/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,eAAe,CAQlB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,eAAe,CAUlB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,eAAe,CAKpE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,eAAe,CAKzE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,CAKhE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GACpB,eAAe,CAKjB"}
|
package/dist/lib/fragments.d.ts
CHANGED
|
@@ -31,11 +31,16 @@ export interface ContextFragment<T extends FragmentData = FragmentData> {
|
|
|
31
31
|
* Used by resolve() to convert to AI SDK format.
|
|
32
32
|
*/
|
|
33
33
|
codec?: FragmentCodec;
|
|
34
|
+
/**
|
|
35
|
+
* Optional metadata for internal tracking.
|
|
36
|
+
* Not rendered to prompt, used for operational purposes like path remapping.
|
|
37
|
+
*/
|
|
38
|
+
metadata?: Record<string, unknown>;
|
|
34
39
|
}
|
|
35
40
|
/**
|
|
36
41
|
* Fragment data can be a primitive, array, object, or nested fragment.
|
|
37
42
|
*/
|
|
38
|
-
export type FragmentData = string | number | boolean | ContextFragment | FragmentData[] | {
|
|
43
|
+
export type FragmentData = string | number | null | undefined | boolean | ContextFragment | FragmentData[] | {
|
|
39
44
|
[key: string]: FragmentData;
|
|
40
45
|
};
|
|
41
46
|
/**
|
|
@@ -54,11 +59,7 @@ export declare function isFragmentObject(data: unknown): data is FragmentObject;
|
|
|
54
59
|
* Type guard to check if a fragment is a message fragment.
|
|
55
60
|
*/
|
|
56
61
|
export declare function isMessageFragment(fragment: ContextFragment): boolean;
|
|
57
|
-
export declare function fragment(name: string, ...children:
|
|
58
|
-
/**
|
|
59
|
-
* Create a role fragment for system prompt instructions.
|
|
60
|
-
*/
|
|
61
|
-
export declare function role(content: string): ContextFragment;
|
|
62
|
+
export declare function fragment(name: string, ...children: FragmentData[]): ContextFragment;
|
|
62
63
|
/**
|
|
63
64
|
* Create a user message fragment.
|
|
64
65
|
* Message fragments are separated from regular fragments during resolve().
|
|
@@ -104,4 +105,43 @@ export declare function message(content: string | UIMessage): ContextFragment;
|
|
|
104
105
|
export declare function assistantText(content: string, options?: {
|
|
105
106
|
id?: string;
|
|
106
107
|
}): ContextFragment;
|
|
108
|
+
/**
|
|
109
|
+
* Symbol to mark fragments for lazy ID resolution.
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
export declare const LAZY_ID: unique symbol;
|
|
113
|
+
/**
|
|
114
|
+
* Lazy fragment configuration for ID resolution.
|
|
115
|
+
*/
|
|
116
|
+
export interface LazyConfig {
|
|
117
|
+
type: 'last-assistant';
|
|
118
|
+
content: string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Lazy fragment that gets its ID resolved during save().
|
|
122
|
+
*/
|
|
123
|
+
export interface LazyFragment extends ContextFragment {
|
|
124
|
+
[LAZY_ID]?: LazyConfig;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Check if a fragment needs lazy ID resolution.
|
|
128
|
+
*/
|
|
129
|
+
export declare function isLazyFragment(fragment: ContextFragment): fragment is LazyFragment;
|
|
130
|
+
/**
|
|
131
|
+
* Create an assistant message fragment that uses the last assistant's ID.
|
|
132
|
+
*
|
|
133
|
+
* - If a pending/persisted assistant message exists, updates it
|
|
134
|
+
* - If none exists, creates a new assistant message
|
|
135
|
+
*
|
|
136
|
+
* Useful for self-correction flows where retries should update
|
|
137
|
+
* the same message instead of creating duplicates.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* // In guardrail retry loop:
|
|
142
|
+
* context.set(lastAssistantMessage(correctedContent));
|
|
143
|
+
* await context.save(); // ID resolved here
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
export declare function lastAssistantMessage(content: string): ContextFragment;
|
|
107
147
|
//# sourceMappingURL=fragments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../src/lib/fragments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,IAAI,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,SAAS,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IACpE;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;IACR;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../src/lib/fragments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,IAAI,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,SAAS,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IACpE;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;IACR;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;OAGG;IAC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;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,eAAe;IACnD,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,eAAe,GACxB,QAAQ,IAAI,YAAY,CAE1B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAWrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-recovery.guardrail.d.ts","sourceRoot":"","sources":["../../../src/lib/guardrails/error-recovery.guardrail.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,eAAO,MAAM,sBAAsB,EAAE,SAsFpC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ContextFragment } from './fragments.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Render fragments to XML.
|
|
4
|
+
*
|
|
5
|
+
* Wraps fragments in a parent tag and renders using XmlRenderer.
|
|
6
|
+
*
|
|
7
|
+
* @param tag - Parent tag name (e.g., 'instructions')
|
|
8
|
+
* @param fragments - Fragments to render
|
|
9
|
+
* @returns XML string
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const xml = render(
|
|
14
|
+
* 'instructions',
|
|
15
|
+
* persona({ name: 'Freya', role: 'Data Assistant' }),
|
|
16
|
+
* guardrail({ rule: 'Never expose PII' }),
|
|
17
|
+
* );
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function render(tag: string, ...fragments: ContextFragment[]): string;
|
|
21
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/lib/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAY,MAAM,gBAAgB,CAAC;AAGhE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,eAAe,EAAE,GAAG,MAAM,CAQ3E"}
|
|
@@ -32,6 +32,14 @@ export declare abstract class ContextRenderer {
|
|
|
32
32
|
* Group fragments by name for groupFragments option.
|
|
33
33
|
*/
|
|
34
34
|
protected groupByName(fragments: ContextFragment[]): Map<string, ContextFragment[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Remove null/undefined from fragments and fragment data recursively.
|
|
37
|
+
* This protects renderers from nullish values and ensures they are ignored
|
|
38
|
+
* consistently across all output formats.
|
|
39
|
+
*/
|
|
40
|
+
protected sanitizeFragments(fragments: ContextFragment[]): ContextFragment[];
|
|
41
|
+
protected sanitizeFragment(fragment: ContextFragment, seen: WeakSet<object>): ContextFragment | null;
|
|
42
|
+
protected sanitizeData(data: FragmentData, seen: WeakSet<object>): FragmentData | undefined;
|
|
35
43
|
/**
|
|
36
44
|
* Template method - dispatches value to appropriate handler.
|
|
37
45
|
*/
|
|
@@ -80,8 +88,8 @@ export declare class TomlRenderer extends ContextRenderer {
|
|
|
80
88
|
* Override renderValue to preserve type information for TOML formatting.
|
|
81
89
|
*/
|
|
82
90
|
protected renderValue(key: string, value: unknown, ctx: RenderContext): string;
|
|
83
|
-
protected renderPrimitive(key: string, value: string,
|
|
84
|
-
protected renderArray(key: string, items: FragmentData[],
|
|
91
|
+
protected renderPrimitive(key: string, value: string, ctx: RenderContext): string;
|
|
92
|
+
protected renderArray(key: string, items: FragmentData[], ctx: RenderContext): string;
|
|
85
93
|
protected renderObject(key: string, obj: FragmentObject, ctx: RenderContext): string;
|
|
86
94
|
protected renderFragment(fragment: ContextFragment, ctx: RenderContext): string;
|
|
87
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract.renderer.d.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nB,GAAG,EAAE,aAAa,GACjB,MAAM;IA4BT,SAAS,CAAC,cAAc,CACtB,QAAQ,EAAE,eAAe,EACzB,GAAG,EAAE,aAAa,GACjB,MAAM;CAqDV;AAED;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,eAAe;;IAC/C,MAAM,CAAC,SAAS,EAAE,eAAe,EAAE,GAAG,MAAM;IA8L5C,SAAS,CAAC,cAAc,CACtB,QAAQ,EAAE,eAAe,EACzB,GAAG,EAAE,aAAa,GACjB,MAAM;IAyBT,SAAS,CAAC,eAAe,CACvB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,aAAa,GACjB,MAAM;IAIT,SAAS,CAAC,WAAW,CACnB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,YAAY,EAAE,EACrB,GAAG,EAAE,aAAa,GACjB,MAAM;IAIT,SAAS,CAAC,YAAY,CACpB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,aAAa,GACjB,MAAM;CAkDV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary-bridges.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/binary-bridges.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"binary-bridges.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/binary-bridges.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,WAAW,CAAC;AAI9D,MAAM,WAAW,kBAAkB;IACjC,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,kBAAkB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,QAAQ,EAAE,iBAAiB,EAAE,GAC/B,aAAa,EAAE,CA2GjB"}
|
|
@@ -11,13 +11,17 @@ import type { SkillsFragmentOptions } from './types.ts';
|
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* ```ts
|
|
14
|
-
* const context = new ContextEngine({ store, chatId: 'demo' })
|
|
14
|
+
* const context = new ContextEngine({ userId: 'demo-user', store, chatId: 'demo' })
|
|
15
15
|
* .set(
|
|
16
16
|
* role('You are a helpful assistant.'),
|
|
17
|
-
* skills({
|
|
17
|
+
* skills({
|
|
18
|
+
* paths: [
|
|
19
|
+
* { host: './skills', sandbox: '/skills/skills' }
|
|
20
|
+
* ]
|
|
21
|
+
* }),
|
|
18
22
|
* );
|
|
19
23
|
*
|
|
20
|
-
* // LLM now sees skill metadata and can read full SKILL.md
|
|
24
|
+
* // LLM now sees skill metadata with sandbox paths and can read full SKILL.md
|
|
21
25
|
* ```
|
|
22
26
|
*/
|
|
23
27
|
export declare function skills(options: SkillsFragmentOptions): ContextFragment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/fragments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,KAAK,EAAiB,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEvE
|
|
1
|
+
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/fragments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,KAAK,EAAiB,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,qBAAqB,GAAG,eAAe,CAkEtE"}
|
|
@@ -13,14 +13,19 @@
|
|
|
13
13
|
* ```ts
|
|
14
14
|
* import { skills } from '@deepagents/context';
|
|
15
15
|
*
|
|
16
|
-
* // Add skills metadata to context
|
|
17
|
-
* const context = new ContextEngine({ store, chatId: 'demo' })
|
|
16
|
+
* // Add skills metadata to context with sandbox path mapping
|
|
17
|
+
* const context = new ContextEngine({ userId: 'demo-user', store, chatId: 'demo' })
|
|
18
18
|
* .set(
|
|
19
19
|
* role('You are a helpful assistant.'),
|
|
20
|
-
* skills({
|
|
20
|
+
* skills({
|
|
21
|
+
* paths: [
|
|
22
|
+
* { host: './skills', sandbox: '/skills/local' },
|
|
23
|
+
* { host: '~/.deepagents/skills', sandbox: '/skills/global' }
|
|
24
|
+
* ]
|
|
25
|
+
* }),
|
|
21
26
|
* );
|
|
22
27
|
*
|
|
23
|
-
* // LLM sees
|
|
28
|
+
* // LLM sees sandbox paths and reads full content when needed
|
|
24
29
|
* ```
|
|
25
30
|
*
|
|
26
31
|
* @module
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE/D;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAyB/D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,CAWpE;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,EAAE,CA6B5E"}
|
|
@@ -13,12 +13,34 @@ export interface SkillMetadata {
|
|
|
13
13
|
/** Full path to the SKILL.md file */
|
|
14
14
|
skillMdPath: string;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* A skill path mapping from host filesystem to sandbox mount.
|
|
18
|
+
*/
|
|
19
|
+
export interface SkillPathMapping {
|
|
20
|
+
/** Original filesystem path where skills are located */
|
|
21
|
+
host: string;
|
|
22
|
+
/** Sandbox mount path that the LLM will use to access skills */
|
|
23
|
+
sandbox: string;
|
|
24
|
+
}
|
|
16
25
|
/**
|
|
17
26
|
* Options for the skills() fragment helper.
|
|
18
27
|
*/
|
|
19
28
|
export interface SkillsFragmentOptions {
|
|
20
|
-
/**
|
|
21
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Skill directories to scan, with host-to-sandbox path mapping.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* skills({
|
|
35
|
+
* paths: [
|
|
36
|
+
* { host: 'apps/backend/dist/skills', sandbox: '/skills/skills' }
|
|
37
|
+
* ]
|
|
38
|
+
* })
|
|
39
|
+
* // Result: skill.data.path = '/skills/skills/dev/SKILL.md'
|
|
40
|
+
* // skill.metadata.originalPath = 'apps/backend/dist/skills/dev/SKILL.md'
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
paths: SkillPathMapping[];
|
|
22
44
|
/** Skill names to exclude from the fragment */
|
|
23
45
|
exclude?: string[];
|
|
24
46
|
/** Skill names to include (if set, only these are included) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/skills/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;;;;OAaG;IACH,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BranchData, BranchInfo, ChatData, ChatInfo, CheckpointData, CheckpointInfo, GraphData, MessageData, SearchOptions, SearchResult, StoredChatData } from './store.ts';
|
|
1
|
+
import type { BranchData, BranchInfo, ChatData, ChatInfo, CheckpointData, CheckpointInfo, DeleteChatOptions, GraphData, ListChatsOptions, MessageData, SearchOptions, SearchResult, StoredChatData } from './store.ts';
|
|
2
2
|
import { ContextStore } from './store.ts';
|
|
3
3
|
/**
|
|
4
4
|
* SQLite-based context store using graph model.
|
|
@@ -13,11 +13,13 @@ export declare class SqliteContextStore extends ContextStore {
|
|
|
13
13
|
upsertChat(chat: ChatData): Promise<StoredChatData>;
|
|
14
14
|
getChat(chatId: string): Promise<StoredChatData | undefined>;
|
|
15
15
|
updateChat(chatId: string, updates: Partial<Pick<ChatData, 'title' | 'metadata'>>): Promise<StoredChatData>;
|
|
16
|
-
listChats(): Promise<ChatInfo[]>;
|
|
16
|
+
listChats(options?: ListChatsOptions): Promise<ChatInfo[]>;
|
|
17
|
+
deleteChat(chatId: string, options?: DeleteChatOptions): Promise<boolean>;
|
|
17
18
|
addMessage(message: MessageData): Promise<void>;
|
|
18
19
|
getMessage(messageId: string): Promise<MessageData | undefined>;
|
|
19
20
|
getMessageChain(headId: string): Promise<MessageData[]>;
|
|
20
21
|
hasChildren(messageId: string): Promise<boolean>;
|
|
22
|
+
getMessages(chatId: string): Promise<MessageData[]>;
|
|
21
23
|
createBranch(branch: BranchData): Promise<void>;
|
|
22
24
|
getBranch(chatId: string, name: string): Promise<BranchData | undefined>;
|
|
23
25
|
getActiveBranch(chatId: string): Promise<BranchData | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite.store.d.ts","sourceRoot":"","sources":["../../../src/lib/store/sqlite.store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,cAAc,
|
|
1
|
+
{"version":3,"file":"sqlite.store.d.ts","sourceRoot":"","sources":["../../../src/lib/store/sqlite.store.ts"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