@mozaik-ai/core 2.11.0 → 2.12.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/index.d.mts +19 -5
- package/dist/index.d.ts +19 -5
- package/dist/index.js +20 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -287,12 +287,26 @@ declare abstract class BaseCondition<T> implements Condition<T> {
|
|
|
287
287
|
interface Action<T> {
|
|
288
288
|
apply(candidate: T): T;
|
|
289
289
|
}
|
|
290
|
-
|
|
290
|
+
interface Rule<T> {
|
|
291
|
+
condition: Condition<T>;
|
|
292
|
+
action: Action<T>;
|
|
293
|
+
apply(candidate: T): T;
|
|
294
|
+
}
|
|
295
|
+
declare class If<T> implements Rule<T> {
|
|
296
|
+
condition: Condition<T>;
|
|
297
|
+
action: Action<T>;
|
|
298
|
+
constructor({ condition, action }: {
|
|
299
|
+
condition: Condition<T>;
|
|
300
|
+
action: Action<T>;
|
|
301
|
+
});
|
|
302
|
+
apply(candidate: T): T;
|
|
303
|
+
}
|
|
304
|
+
declare class Loop<T> {
|
|
291
305
|
private condition;
|
|
292
306
|
private action;
|
|
293
|
-
constructor({
|
|
294
|
-
|
|
295
|
-
|
|
307
|
+
constructor({ condition, action }: {
|
|
308
|
+
condition: Condition<T>;
|
|
309
|
+
action: Action<T>;
|
|
296
310
|
});
|
|
297
311
|
apply(candidate: T): T;
|
|
298
312
|
}
|
|
@@ -306,4 +320,4 @@ declare class InMemoryContextRepository implements ContextRepository {
|
|
|
306
320
|
private clone;
|
|
307
321
|
}
|
|
308
322
|
|
|
309
|
-
export { type Action, BaseCondition, Context, ContextItem, type ContextRepository, DeveloperMessage, FunctionCall, FunctionCallOutput, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, InMemoryContextRepository, InferenceRequest, InferenceResponse, InputTokenDetails, ModelMessage, OpenAIResponses, OutputTokenDetails, Reasoning, Rule, TokenUsage, type Tool, UserMessage };
|
|
323
|
+
export { type Action, BaseCondition, Context, ContextItem, type ContextRepository, DeveloperMessage, FunctionCall, FunctionCallOutput, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, If, InMemoryContextRepository, InferenceRequest, InferenceResponse, InputTokenDetails, Loop, ModelMessage, OpenAIResponses, OutputTokenDetails, Reasoning, type Rule, TokenUsage, type Tool, UserMessage };
|
package/dist/index.d.ts
CHANGED
|
@@ -287,12 +287,26 @@ declare abstract class BaseCondition<T> implements Condition<T> {
|
|
|
287
287
|
interface Action<T> {
|
|
288
288
|
apply(candidate: T): T;
|
|
289
289
|
}
|
|
290
|
-
|
|
290
|
+
interface Rule<T> {
|
|
291
|
+
condition: Condition<T>;
|
|
292
|
+
action: Action<T>;
|
|
293
|
+
apply(candidate: T): T;
|
|
294
|
+
}
|
|
295
|
+
declare class If<T> implements Rule<T> {
|
|
296
|
+
condition: Condition<T>;
|
|
297
|
+
action: Action<T>;
|
|
298
|
+
constructor({ condition, action }: {
|
|
299
|
+
condition: Condition<T>;
|
|
300
|
+
action: Action<T>;
|
|
301
|
+
});
|
|
302
|
+
apply(candidate: T): T;
|
|
303
|
+
}
|
|
304
|
+
declare class Loop<T> {
|
|
291
305
|
private condition;
|
|
292
306
|
private action;
|
|
293
|
-
constructor({
|
|
294
|
-
|
|
295
|
-
|
|
307
|
+
constructor({ condition, action }: {
|
|
308
|
+
condition: Condition<T>;
|
|
309
|
+
action: Action<T>;
|
|
296
310
|
});
|
|
297
311
|
apply(candidate: T): T;
|
|
298
312
|
}
|
|
@@ -306,4 +320,4 @@ declare class InMemoryContextRepository implements ContextRepository {
|
|
|
306
320
|
private clone;
|
|
307
321
|
}
|
|
308
322
|
|
|
309
|
-
export { type Action, BaseCondition, Context, ContextItem, type ContextRepository, DeveloperMessage, FunctionCall, FunctionCallOutput, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, InMemoryContextRepository, InferenceRequest, InferenceResponse, InputTokenDetails, ModelMessage, OpenAIResponses, OutputTokenDetails, Reasoning, Rule, TokenUsage, type Tool, UserMessage };
|
|
323
|
+
export { type Action, BaseCondition, Context, ContextItem, type ContextRepository, DeveloperMessage, FunctionCall, FunctionCallOutput, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, If, InMemoryContextRepository, InferenceRequest, InferenceResponse, InputTokenDetails, Loop, ModelMessage, OpenAIResponses, OutputTokenDetails, Reasoning, type Rule, TokenUsage, type Tool, UserMessage };
|
package/dist/index.js
CHANGED
|
@@ -39,15 +39,16 @@ __export(index_exports, {
|
|
|
39
39
|
Gpt54: () => Gpt54,
|
|
40
40
|
Gpt54Mini: () => Gpt54Mini,
|
|
41
41
|
Gpt54Nano: () => Gpt54Nano,
|
|
42
|
+
If: () => If,
|
|
42
43
|
InMemoryContextRepository: () => InMemoryContextRepository,
|
|
43
44
|
InferenceRequest: () => InferenceRequest,
|
|
44
45
|
InferenceResponse: () => InferenceResponse,
|
|
45
46
|
InputTokenDetails: () => InputTokenDetails,
|
|
47
|
+
Loop: () => Loop,
|
|
46
48
|
ModelMessage: () => ModelMessage,
|
|
47
49
|
OpenAIResponses: () => OpenAIResponses,
|
|
48
50
|
OutputTokenDetails: () => OutputTokenDetails,
|
|
49
51
|
Reasoning: () => Reasoning,
|
|
50
|
-
Rule: () => Rule,
|
|
51
52
|
TokenUsage: () => TokenUsage,
|
|
52
53
|
UserMessage: () => UserMessage
|
|
53
54
|
});
|
|
@@ -534,10 +535,10 @@ var OrCondition = class extends BaseCondition {
|
|
|
534
535
|
};
|
|
535
536
|
|
|
536
537
|
// src/core/context-engine/rule/rule.ts
|
|
537
|
-
var
|
|
538
|
-
constructor({
|
|
539
|
-
this.condition =
|
|
540
|
-
this.action =
|
|
538
|
+
var If = class {
|
|
539
|
+
constructor({ condition, action }) {
|
|
540
|
+
this.condition = condition;
|
|
541
|
+
this.action = action;
|
|
541
542
|
}
|
|
542
543
|
apply(candidate) {
|
|
543
544
|
if (this.condition.isSatisfiedBy(candidate)) {
|
|
@@ -546,6 +547,18 @@ var Rule = class {
|
|
|
546
547
|
return candidate;
|
|
547
548
|
}
|
|
548
549
|
};
|
|
550
|
+
var Loop = class {
|
|
551
|
+
constructor({ condition, action }) {
|
|
552
|
+
this.condition = condition;
|
|
553
|
+
this.action = action;
|
|
554
|
+
}
|
|
555
|
+
apply(candidate) {
|
|
556
|
+
while (this.condition.isSatisfiedBy(candidate)) {
|
|
557
|
+
candidate = this.action.apply(candidate);
|
|
558
|
+
}
|
|
559
|
+
return candidate;
|
|
560
|
+
}
|
|
561
|
+
};
|
|
549
562
|
|
|
550
563
|
// src/memory/in-memory-context-repository.ts
|
|
551
564
|
var InMemoryContextRepository = class {
|
|
@@ -599,15 +612,16 @@ var InMemoryContextRepository = class {
|
|
|
599
612
|
Gpt54,
|
|
600
613
|
Gpt54Mini,
|
|
601
614
|
Gpt54Nano,
|
|
615
|
+
If,
|
|
602
616
|
InMemoryContextRepository,
|
|
603
617
|
InferenceRequest,
|
|
604
618
|
InferenceResponse,
|
|
605
619
|
InputTokenDetails,
|
|
620
|
+
Loop,
|
|
606
621
|
ModelMessage,
|
|
607
622
|
OpenAIResponses,
|
|
608
623
|
OutputTokenDetails,
|
|
609
624
|
Reasoning,
|
|
610
|
-
Rule,
|
|
611
625
|
TokenUsage,
|
|
612
626
|
UserMessage
|
|
613
627
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/core/context-runtime/context.ts","../src/core/context-runtime/context-item.ts","../src/core/context-runtime/content.ts","../src/core/context-runtime/content/input-text.ts","../src/core/context-runtime/input/user-message.ts","../src/core/context-runtime/input/developer-message.ts","../src/core/context-runtime/content/output-text.ts","../src/core/context-runtime/output/model-message.ts","../src/core/context-runtime/output/function-call.ts","../src/core/context-runtime/output/reasoning.ts","../src/core/context-runtime/input/function-call-output.ts","../src/core/generative-model/inference-response.ts","../src/core/generative-model/token-usage.ts","../src/providers/openai/runtime/openai-responses.ts","../src/core/generative-model/inference-request.ts","../src/providers/openai/reasoning-effort.ts","../src/providers/openai/models/gpt-5-4-nano.ts","../src/providers/openai/models/gpt-5-4.ts","../src/providers/openai/models/gpt-5-4-mini.ts","../src/core/context-engine/condition/condition.ts","../src/core/context-engine/rule/rule.ts","../src/memory/in-memory-context-repository.ts"],"sourcesContent":["import { Context } from \"@core/context-runtime/context\"\nimport { ContextItem } from \"@core/context-runtime/context-item\"\nimport { UserMessage } from \"@core/context-runtime/input/user-message\"\nimport { DeveloperMessage } from \"@core/context-runtime/input/developer-message\"\nimport { ModelMessage } from \"@core/context-runtime/output/model-message\"\nimport { FunctionCall } from \"@core/context-runtime/output/function-call\"\nimport { Reasoning } from \"@core/context-runtime/output/reasoning\"\nimport { GenerativeModel } from \"@core/generative-model/generative-model\"\nimport { FunctionCallOutput } from \"@core/context-runtime/input/function-call-output\"\nimport { ContextRepository } from \"@core/context-runtime/context-repository\"\nimport { OpenAIResponses } from \"@openai/runtime/openai-responses\"\nimport { InferenceRequest } from \"@core/generative-model/inference-request\"\nimport { Gpt54Nano } from \"@openai/models/gpt-5-4-nano\"\nimport { Gpt54 } from \"@openai/models/gpt-5-4\"\nimport { Gpt54Mini } from \"@openai/models/gpt-5-4-mini\"\nimport { InferenceResponse } from \"@core/generative-model/inference-response\"\nimport { InputTokenDetails, OutputTokenDetails, TokenUsage } from \"@core/generative-model/token-usage\"\nimport { Tool } from \"@core/generative-model/tool\"\nimport { BaseCondition, Condition } from \"@core/context-engine/condition/condition\"\nimport { Action, Rule } from \"@core/context-engine/rule/rule\"\nimport { InMemoryContextRepository } from \"./memory/in-memory-context-repository\"\n\nexport {\n\tContext,\n\tContextItem,\n\tUserMessage,\n\tDeveloperMessage,\n\tModelMessage,\n\tFunctionCall,\n\tFunctionCallOutput,\n\tReasoning,\n\tGenerativeModel,\n\tContextRepository,\n\tInMemoryContextRepository,\n\tOpenAIResponses,\n\tGpt54,\n\tGpt54Mini,\n\tGpt54Nano,\n\tInferenceRequest,\n\tInferenceResponse,\n\tTokenUsage,\n\tInputTokenDetails,\n\tOutputTokenDetails,\n\tTool,\n\tBaseCondition,\n\tAction,\n\tRule,\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class Context {\n\treadonly id: string\n\treadonly projectId: string\n\treadonly items: ContextItem[]\n\n\tconstructor(id: string, projectId: string, items: ContextItem[]) {\n\t\tthis.projectId = projectId\n\t\tthis.id = id\n\t\tthis.items = items\n\t}\n\n\taddItem(item: ContextItem): Context {\n\t\tthis.items.push(item)\n\t\treturn this\n\t}\n\n\tapplyModelOutput(items: ContextItem[]): Context {\n\t\tfor (const item of items) {\n\t\t\tconst itemType = item.getType()\n\t\t\tif (itemType !== \"function_call\" && itemType !== \"message\" && itemType !== \"reasoning\") {\n\t\t\t\tthrow new Error(`Invalid item type: ${itemType}`)\n\t\t\t}\n\t\t}\n\t\tthis.items.push(...items)\n\t\treturn this\n\t}\n\n\tgetItems(): ContextItem[] {\n\t\treturn this.items\n\t}\n\n\tstatic create(projectId: string): Context {\n\t\tconst id = crypto.randomUUID()\n\t\treturn new Context(id, projectId, [])\n\t}\n\n\tstatic rehydrate(data: { id: string; projectId: string; items: ContextItem[] }): Context {\n\t\treturn new Context(data.id, data.projectId, data.items)\n\t}\n\n\ttoJSON(): any {\n\t\treturn this.items.map((item) => item.toJSON())\n\t}\n}\n","export abstract class ContextItem {\n\tabstract readonly type: string\n\n\tgetType(): string {\n\t\treturn this.type\n\t}\n\n\tabstract toJSON(): any\n}\n","export abstract class Content {\n\tabstract readonly type: string\n}\n","import { Content } from \"@core/context-runtime/content\"\n\nexport class InputText extends Content {\n\treadonly type = \"input_text\"\n\n\tprivate constructor(public readonly text: string) {\n\t\tsuper()\n\t}\n\n\tstatic create(text: string): InputText {\n\t\treturn new InputText(text)\n\t}\n\n\tstatic rehydrate(data: { text: string }): InputText {\n\t\treturn new InputText(data.text)\n\t}\n\n\ttoJSON(): any[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttype: this.type,\n\t\t\t\ttext: this.text,\n\t\t\t},\n\t\t]\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\nimport { InputText } from \"@core/context-runtime/content/input-text\"\n\nexport class UserMessage extends ContextItem {\n\treadonly type = \"message\"\n\treadonly role = \"user\"\n\treadonly content: InputText\n\n\tprivate constructor(content: InputText) {\n\t\tsuper()\n\t\tthis.content = content\n\t}\n\n\tstatic create(text: string): UserMessage {\n\t\tconst content = InputText.create(text)\n\t\treturn new UserMessage(content)\n\t}\n\n\tstatic rehydrate(data: { text: string }): UserMessage {\n\t\tconst content = InputText.rehydrate(data)\n\t\treturn new UserMessage(content)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\trole: this.role,\n\t\t\tcontent: this.content.toJSON(),\n\t\t}\n\t}\n}\n","import { InputText } from \"@core/context-runtime/content/input-text\"\nimport { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class DeveloperMessage extends ContextItem {\n\treadonly type = \"message\"\n\treadonly role = \"developer\"\n\treadonly content: InputText\n\n\tprivate constructor(content: InputText) {\n\t\tsuper()\n\t\tthis.content = content\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\trole: this.role,\n\t\t\tcontent: this.content.toJSON(),\n\t\t}\n\t}\n\n\tstatic create(text: string): DeveloperMessage {\n\t\tconst content = InputText.create(text)\n\t\treturn new DeveloperMessage(content)\n\t}\n\n\tstatic rehydrate(data: { text: string }): DeveloperMessage {\n\t\tconst content = InputText.rehydrate(data)\n\t\treturn new DeveloperMessage(content)\n\t}\n}\n","import { Content } from \"@core/context-runtime/content\"\n\nexport class OutputText extends Content {\n\treadonly type = \"output_text\"\n\n\tprivate constructor(public readonly text: string) {\n\t\tsuper()\n\t}\n\n\tstatic rehydrate(data: { text: string }): OutputText {\n\t\treturn new OutputText(data.text)\n\t}\n\n\ttoJSON(): any[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttype: this.type,\n\t\t\t\ttext: this.text,\n\t\t\t},\n\t\t]\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\nimport { OutputText } from \"@core/context-runtime/content/output-text\"\n\nexport class ModelMessage extends ContextItem {\n\treadonly type = \"message\"\n\treadonly role = \"assistant\"\n\treadonly content: OutputText\n\n\tprivate constructor(content: OutputText) {\n\t\tsuper()\n\t\tthis.content = content\n\t}\n\n\tstatic rehydrate(data: { text: string }): ModelMessage {\n\t\tconst content = OutputText.rehydrate(data)\n\t\treturn new ModelMessage(content)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\trole: this.role,\n\t\t\tcontent: this.content.toJSON(),\n\t\t}\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class FunctionCall extends ContextItem {\n\treadonly type = \"function_call\"\n\treadonly callId: string\n\treadonly name: string\n\treadonly args: string\n\n\tprivate constructor(callId: string, name: string, args: string) {\n\t\tsuper()\n\t\tthis.callId = callId\n\t\tthis.name = name\n\t\tthis.args = args\n\t}\n\n\tstatic rehydrate(data: { callId: string; name: string; args: string }): FunctionCall {\n\t\treturn new FunctionCall(data.callId, data.name, data.args)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tcallId: this.callId,\n\t\t\tname: this.name,\n\t\t\targuments: this.args,\n\t\t}\n\t}\n}\n","import { InputText } from \"@core/context-runtime/content/input-text\"\nimport { SummaryText } from \"@core/context-runtime/content/summary-text\"\nimport { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class Reasoning extends ContextItem {\n\treadonly type = \"reasoning\"\n\treadonly content: InputText | undefined\n\treadonly encryptedContent: string | undefined\n\treadonly summary: SummaryText[]\n\n\tprivate constructor(\n\t\tcontent: InputText | undefined,\n\t\tencryptedContent?: string | undefined,\n\t\tsummary: SummaryText[] = [],\n\t) {\n\t\tsuper()\n\t\tthis.content = content\n\t\tthis.encryptedContent = encryptedContent\n\t\tthis.summary = summary\n\t}\n\n\tstatic rehydrate(data: {\n\t\tcontent: InputText | undefined\n\t\tencryptedContent: string | undefined\n\t\tsummary: SummaryText[]\n\t}): Reasoning {\n\t\treturn new Reasoning(data.content, data.encryptedContent, data.summary)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tcontent: this.content?.toJSON(),\n\t\t\tencryptedContent: this.encryptedContent,\n\t\t\tsummary: this.summary.map((s) => s.toJSON()),\n\t\t}\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\nimport { InputText } from \"@core/context-runtime/content/input-text\"\n\nexport class FunctionCallOutput extends ContextItem {\n\treadonly type = \"function_call_output\"\n\treadonly callId: string\n\treadonly output: InputText[]\n\n\tprivate constructor(callId: string, output: InputText[]) {\n\t\tsuper()\n\t\tthis.callId = callId\n\t\tthis.output = output\n\t}\n\n\tstatic create(callId: string, output: InputText[]): FunctionCallOutput {\n\t\treturn new FunctionCallOutput(callId, output)\n\t}\n\n\tstatic rehydrate(data: { callId: string; output: InputText[] }): FunctionCallOutput {\n\t\treturn new FunctionCallOutput(data.callId, data.output)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tcallId: this.callId,\n\t\t\toutput: this.output.map((o) => o.toJSON()),\n\t\t}\n\t}\n}\n","import { ContextItem } from \"src\"\nimport { TokenUsage } from \"./token-usage\"\n\nexport class InferenceResponse {\n\treadonly contextItems: ContextItem[]\n\treadonly tokenUsage?: TokenUsage\n\n\tconstructor(contextItems: ContextItem[], tokenUsage: TokenUsage | undefined) {\n\t\tthis.contextItems = contextItems\n\t\tthis.tokenUsage = tokenUsage\n\t}\n}\n","export class InputTokenDetails {\n\treadonly cached_tokens: number\n\n\tconstructor(cached_tokens: number) {\n\t\tthis.cached_tokens = cached_tokens\n\t}\n}\n\nexport class OutputTokenDetails {\n\treadonly reasoning_tokens: number\n\n\tconstructor(reasoning_tokens: number) {\n\t\tthis.reasoning_tokens = reasoning_tokens\n\t}\n}\n\nexport class TokenUsage {\n\treadonly inputTokens: number\n\treadonly outputTokens: number\n\treadonly totalTokens: number\n\treadonly inputTokenDetails: InputTokenDetails\n\treadonly outputTokenDetails: OutputTokenDetails\n\n\tconstructor(\n\t\tinputTokens: number,\n\t\toutputTokens: number,\n\t\ttotalTokens: number,\n\t\tinputTokenDetails: InputTokenDetails,\n\t\toutputTokenDetails: OutputTokenDetails,\n\t) {\n\t\tthis.inputTokens = inputTokens\n\t\tthis.outputTokens = outputTokens\n\t\tthis.totalTokens = totalTokens\n\t\tthis.inputTokenDetails = inputTokenDetails\n\t\tthis.outputTokenDetails = outputTokenDetails\n\t}\n}\n","import { Context } from \"@core/context-runtime/context\"\nimport { ContextItem } from \"@core/context-runtime/context-item\"\nimport { FunctionCall } from \"@core/context-runtime/output/function-call\"\nimport { ModelMessage } from \"@core/context-runtime/output/model-message\"\nimport { Reasoning } from \"@core/context-runtime/output/reasoning\"\nimport { InferenceRequest } from \"@core/generative-model/inference-request\"\nimport { InferenceResponse } from \"@core/generative-model/inference-response\"\nimport { ModelRuntime } from \"@core/generative-model/runtime/model-runtime\"\nimport { InputTokenDetails, OutputTokenDetails, TokenUsage } from \"@core/generative-model/token-usage\"\nimport OpenAI from \"openai\"\n\nexport class OpenAIResponses implements ModelRuntime {\n\tprivate readonly client: OpenAI\n\tconstructor() {\n\t\tthis.client = new OpenAI()\n\t}\n\n\tasync infer(inferenceRequest: InferenceRequest): Promise<InferenceResponse> {\n\t\tconst input = this.mapContextToRequest(inferenceRequest.context)\n\n\t\tconst specification = inferenceRequest.model.specification\n\n\t\tlet request: any = {\n\t\t\tmodel: specification.name,\n\t\t\tinput: input,\n\t\t}\n\n\t\tif (specification.supportFunctionCalling && inferenceRequest.model.getTools().length > 0) {\n\t\t\trequest.tools = inferenceRequest.model.getTools().map((tool) => {\n\t\t\t\treturn {\n\t\t\t\t\ttype: tool.type,\n\t\t\t\t\tname: tool.name,\n\t\t\t\t\tdescription: tool.description,\n\t\t\t\t\tparameters: tool.parameters,\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tif (specification.supportReasoningEffort) {\n\t\t\trequest.reasoning = {\n\t\t\t\teffort: inferenceRequest.model.getReasoningEffort(),\n\t\t\t}\n\t\t}\n\n\t\tconst response = await this.client.responses.create(request)\n\n\t\tconst contextItems = this.extractContextItems(response)\n\t\tconst tokenUsage = this.extractTokenUsage(response)\n\t\treturn new InferenceResponse(contextItems, tokenUsage)\n\t}\n\n\textractTokenUsage(response: OpenAI.Responses.Response): TokenUsage | undefined {\n\t\tif (!response.usage) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn new TokenUsage(\n\t\t\tresponse.usage.input_tokens,\n\t\t\tresponse.usage.output_tokens,\n\t\t\tresponse.usage.total_tokens,\n\t\t\tnew InputTokenDetails(response.usage.input_tokens_details.cached_tokens),\n\t\t\tnew OutputTokenDetails(response.usage.output_tokens_details.reasoning_tokens),\n\t\t)\n\t}\n\n\tmapContextToRequest(context: Context): any[] {\n\t\treturn context.getItems().map((item) => item.toJSON())\n\t}\n\n\textractContextItems(response: any): ContextItem[] {\n\t\treturn response.output.map((item: any) => {\n\t\t\tif (item.type === \"message\" && item.status === \"completed\") {\n\t\t\t\treturn ModelMessage.rehydrate(item.content[0] as { text: string })\n\t\t\t}\n\t\t\tif (item.type === \"function_call\" && item.status === \"completed\") {\n\t\t\t\treturn FunctionCall.rehydrate(item)\n\t\t\t}\n\t\t\tif (item.type === \"reasoning\") {\n\t\t\t\treturn Reasoning.rehydrate(item)\n\t\t\t}\n\t\t})\n\t}\n}\n","import { Context } from \"@core/context-runtime/context\"\nimport { GenerativeModel } from \"./generative-model\"\nimport { ReasoningEffort } from \"./capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"./capabilities/tool-calling\"\n\nexport class InferenceRequest {\n\treadonly model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability\n\treadonly context: Context\n\n\tconstructor(model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability, context: Context) {\n\t\tthis.model = model\n\t\tthis.context = context\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\n\nexport type OpenAIReasoningEffortType = \"xhigh\" | \"high\" | \"medium\" | \"low\" | \"none\"\n\nexport class OpenAIReasoningEffort implements ReasoningEffort<OpenAIReasoningEffortType> {\n\treasoningEffort: OpenAIReasoningEffortType\n\n\tconstructor(reasoningEffort: OpenAIReasoningEffortType) {\n\t\tthis.reasoningEffort = reasoningEffort\n\t}\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.reasoningEffort = effort\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\tif (!this.reasoningEffort) {\n\t\t\tthrow new Error(\"Reasoning effort not supported\")\n\t\t}\n\t\treturn this.reasoningEffort\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@core/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@core/generative-model/generative-model\"\nimport { Tool } from \"@core/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@openai/reasoning-effort\"\n\nexport class Gpt54Nano implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {\n\treadonly specification = {\n\t\tname: \"gpt-5.4-nano\",\n\t\tsupportReasoningEffort: true,\n\t\tdefaultReasoningEffort: \"none\" as OpenAIReasoningEffortType,\n\t\tsupportStreaming: true,\n\t\tcontextWindowSize: 400_000,\n\t\tmaxOutputTokens: 128_000,\n\t\tsupportFunctionCalling: true,\n\t}\n\n\tprivate tools: Tool[] = []\n\n\tprivate readonly effort: OpenAIReasoningEffort = new OpenAIReasoningEffort(\n\t\tthis.specification.defaultReasoningEffort,\n\t)\n\n\tsetTools(tools: Tool[]): void {\n\t\tthis.tools = tools\n\t}\n\n\tgetTools(): Tool[] {\n\t\treturn this.tools\n\t}\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.effort.setReasoningEffort(effort)\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\treturn this.effort.getReasoningEffort()\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@core/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@core/generative-model/generative-model\"\nimport { Tool } from \"@core/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@openai/reasoning-effort\"\n\nexport class Gpt54 implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {\n\treadonly specification = {\n\t\tname: \"gpt-5.4\",\n\t\tsupportReasoningEffort: true,\n\t\tdefaultReasoningEffort: \"none\" as OpenAIReasoningEffortType,\n\t\tsupportStreaming: true,\n\t\tcontextWindowSize: 1_050_000,\n\t\tmaxOutputTokens: 128_000,\n\t\tsupportFunctionCalling: true,\n\t}\n\n\tprivate tools: Tool[] = []\n\n\tsetTools(tools: Tool[]): void {\n\t\tthis.tools = tools\n\t}\n\n\tgetTools(): Tool[] {\n\t\treturn this.tools\n\t}\n\n\tprivate readonly effort: OpenAIReasoningEffort = new OpenAIReasoningEffort(\n\t\tthis.specification.defaultReasoningEffort,\n\t)\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.effort.setReasoningEffort(effort)\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\treturn this.effort.getReasoningEffort()\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@core/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@core/generative-model/generative-model\"\nimport { Tool } from \"@core/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@openai/reasoning-effort\"\n\nexport class Gpt54Mini implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {\n\treadonly specification = {\n\t\tname: \"gpt-5.4-mini\",\n\t\tsupportReasoningEffort: true,\n\t\tdefaultReasoningEffort: \"none\" as OpenAIReasoningEffortType,\n\t\tsupportStreaming: true,\n\t\tcontextWindowSize: 400_000,\n\t\tmaxOutputTokens: 128_000,\n\t\tsupportFunctionCalling: true,\n\t}\n\n\tprivate tools: Tool[] = []\n\n\tprivate readonly effort: OpenAIReasoningEffort = new OpenAIReasoningEffort(\n\t\tthis.specification.defaultReasoningEffort,\n\t)\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.effort.setReasoningEffort(effort)\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\treturn this.effort.getReasoningEffort()\n\t}\n\n\tsetTools(tools: Tool[]): void {\n\t\tthis.tools = tools\n\t}\n\n\tgetTools(): Tool[] {\n\t\treturn this.tools\n\t}\n}\n","export interface Condition<T> {\n\tisSatisfiedBy(candidate: T): boolean\n\tand(other: Condition<T>): Condition<T>\n\tor(other: Condition<T>): Condition<T>\n\tnot(): Condition<T>\n}\n\nexport abstract class BaseCondition<T> implements Condition<T> {\n\tabstract isSatisfiedBy(candidate: T): boolean\n\n\tand(other: Condition<T>): Condition<T> {\n\t\treturn new AndCondition(this, other)\n\t}\n\n\tor(other: Condition<T>): Condition<T> {\n\t\treturn new OrCondition(this, other)\n\t}\n\n\tnot(): Condition<T> {\n\t\treturn new NotCondition(this)\n\t}\n}\n\nexport class AndCondition<T> extends BaseCondition<T> {\n\tconstructor(\n\t\tprivate readonly left: Condition<T>,\n\t\tprivate readonly right: Condition<T>,\n\t) {\n\t\tsuper()\n\t}\n\n\tisSatisfiedBy(candidate: T): boolean {\n\t\treturn this.left.isSatisfiedBy(candidate) && this.right.isSatisfiedBy(candidate)\n\t}\n}\n\nexport class NotCondition<T> extends BaseCondition<T> {\n\tconstructor(private readonly condition: Condition<T>) {\n\t\tsuper()\n\t}\n\n\tisSatisfiedBy(candidate: T): boolean {\n\t\treturn !this.condition.isSatisfiedBy(candidate)\n\t}\n}\n\nexport class OrCondition<T> extends BaseCondition<T> {\n\tconstructor(\n\t\tprivate readonly left: Condition<T>,\n\t\tprivate readonly right: Condition<T>,\n\t) {\n\t\tsuper()\n\t}\n\n\tisSatisfiedBy(candidate: T): boolean {\n\t\treturn this.left.isSatisfiedBy(candidate) || this.right.isSatisfiedBy(candidate)\n\t}\n}\n","import { Condition } from \"@core/context-engine/condition/condition\"\n\nexport interface Action<T> {\n\tapply(candidate: T): T\n}\n\nexport class Rule<T> {\n\tprivate condition: Condition<T>\n\tprivate action: Action<T>\n\n\tconstructor({ when, then }: { when: Condition<T>; then: Action<T> }) {\n\t\tthis.condition = when\t\n\t\tthis.action = then\n\t}\n\n\tapply(candidate: T): T {\n\t\tif (this.condition.isSatisfiedBy(candidate)) {\n\t\t\treturn this.action.apply(candidate)\n\t\t}\n\t\treturn candidate\n\t}\n}\n","import { Context } from \"@core/context-runtime/context\"\nimport { ContextRepository } from \"@core/context-runtime/context-repository\"\n\nexport class InMemoryContextRepository implements ContextRepository {\n\tprivate readonly store = new Map<string, Context>()\n\tprivate readonly projectIndex = new Map<string, Set<string>>()\n\n\tasync save(context: Context): Promise<void> {\n\t\tconst existing = this.store.get(context.id)\n\t\tif (existing && existing.projectId !== context.projectId) {\n\t\t\tconst prevSet = this.projectIndex.get(existing.projectId)\n\t\t\tprevSet?.delete(existing.id)\n\t\t\tif (prevSet && prevSet.size === 0) this.projectIndex.delete(existing.projectId)\n\t\t}\n\n\t\tthis.store.set(context.id, this.clone(context))\n\n\t\tlet set = this.projectIndex.get(context.projectId)\n\t\tif (!set) {\n\t\t\tset = new Set<string>()\n\t\t\tthis.projectIndex.set(context.projectId, set)\n\t\t}\n\t\tset.add(context.id)\n\t}\n\n\tasync get(id: string): Promise<Context> {\n\t\tconst context = this.store.get(id)\n\t\tif (!context) {\n\t\t\tthrow new Error(`Context not found: ${id}`)\n\t\t}\n\t\treturn this.clone(context)\n\t}\n\n\tasync getByProjectId(projectId: string): Promise<Context[]> {\n\t\tconst ids = this.projectIndex.get(projectId)\n\t\tif (!ids || ids.size === 0) return []\n\t\treturn [...ids]\n\t\t\t.map((id) => this.store.get(id))\n\t\t\t.filter((c): c is Context => Boolean(c))\n\t\t\t.map((c) => this.clone(c))\n\t}\n\n\tprivate clone(context: Context): Context {\n\t\treturn Context.rehydrate({\n\t\t\tid: context.id,\n\t\t\tprojectId: context.projectId,\n\t\t\titems: [...context.getItems()],\n\t\t})\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAM,UAAN,MAAM,SAAQ;AAAA,EAKpB,YAAY,IAAY,WAAmB,OAAsB;AAChE,SAAK,YAAY;AACjB,SAAK,KAAK;AACV,SAAK,QAAQ;AAAA,EACd;AAAA,EAEA,QAAQ,MAA4B;AACnC,SAAK,MAAM,KAAK,IAAI;AACpB,WAAO;AAAA,EACR;AAAA,EAEA,iBAAiB,OAA+B;AAC/C,eAAW,QAAQ,OAAO;AACzB,YAAM,WAAW,KAAK,QAAQ;AAC9B,UAAI,aAAa,mBAAmB,aAAa,aAAa,aAAa,aAAa;AACvF,cAAM,IAAI,MAAM,sBAAsB,QAAQ,EAAE;AAAA,MACjD;AAAA,IACD;AACA,SAAK,MAAM,KAAK,GAAG,KAAK;AACxB,WAAO;AAAA,EACR;AAAA,EAEA,WAA0B;AACzB,WAAO,KAAK;AAAA,EACb;AAAA,EAEA,OAAO,OAAO,WAA4B;AACzC,UAAM,KAAK,OAAO,WAAW;AAC7B,WAAO,IAAI,SAAQ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;AACA,QAAI,IAAI,QAAQ,EAAE;AAAA,EACnB;AAAA,EAEA,MAAM,IAAI,IAA8B;AACvC,UAAM,UAAU,KAAK,MAAM,IAAI,EAAE;AACjC,QAAI,CAAC,SAAS;AACb,YAAM,IAAI,MAAM,sBAAsB,EAAE,EAAE;AAAA,IAC3C;AACA,WAAO,KAAK,MAAM,OAAO;AAAA,EAC1B;AAAA,EAEA,MAAM,eAAe,WAAuC;AAC3D,UAAM,MAAM,KAAK,aAAa,IAAI,SAAS;AAC3C,QAAI,CAAC,OAAO,IAAI,SAAS,EAAG,QAAO,CAAC;AACpC,WAAO,CAAC,GAAG,GAAG,EACZ,IAAI,CAAC,OAAO,KAAK,MAAM,IAAI,EAAE,CAAC,EAC9B,OAAO,CAAC,MAAoB,QAAQ,CAAC,CAAC,EACtC,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;AAAA,EAC3B;AAAA,EAEQ,MAAM,SAA2B;AACxC,WAAO,QAAQ,UAAU;AAAA,MACxB,IAAI,QAAQ;AAAA,MACZ,WAAW,QAAQ;AAAA,MACnB,OAAO,CAAC,GAAG,QAAQ,SAAS,CAAC;AAAA,IAC9B,CAAC;AAAA,EACF;AACD;","names":["OpenAI"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/core/context-runtime/context.ts","../src/core/context-runtime/context-item.ts","../src/core/context-runtime/content.ts","../src/core/context-runtime/content/input-text.ts","../src/core/context-runtime/input/user-message.ts","../src/core/context-runtime/input/developer-message.ts","../src/core/context-runtime/content/output-text.ts","../src/core/context-runtime/output/model-message.ts","../src/core/context-runtime/output/function-call.ts","../src/core/context-runtime/output/reasoning.ts","../src/core/context-runtime/input/function-call-output.ts","../src/core/generative-model/inference-response.ts","../src/core/generative-model/token-usage.ts","../src/providers/openai/runtime/openai-responses.ts","../src/core/generative-model/inference-request.ts","../src/providers/openai/reasoning-effort.ts","../src/providers/openai/models/gpt-5-4-nano.ts","../src/providers/openai/models/gpt-5-4.ts","../src/providers/openai/models/gpt-5-4-mini.ts","../src/core/context-engine/condition/condition.ts","../src/core/context-engine/rule/rule.ts","../src/memory/in-memory-context-repository.ts"],"sourcesContent":["import { Context } from \"@core/context-runtime/context\"\nimport { ContextItem } from \"@core/context-runtime/context-item\"\nimport { UserMessage } from \"@core/context-runtime/input/user-message\"\nimport { DeveloperMessage } from \"@core/context-runtime/input/developer-message\"\nimport { ModelMessage } from \"@core/context-runtime/output/model-message\"\nimport { FunctionCall } from \"@core/context-runtime/output/function-call\"\nimport { Reasoning } from \"@core/context-runtime/output/reasoning\"\nimport { GenerativeModel } from \"@core/generative-model/generative-model\"\nimport { FunctionCallOutput } from \"@core/context-runtime/input/function-call-output\"\nimport { ContextRepository } from \"@core/context-runtime/context-repository\"\nimport { OpenAIResponses } from \"@openai/runtime/openai-responses\"\nimport { InferenceRequest } from \"@core/generative-model/inference-request\"\nimport { Gpt54Nano } from \"@openai/models/gpt-5-4-nano\"\nimport { Gpt54 } from \"@openai/models/gpt-5-4\"\nimport { Gpt54Mini } from \"@openai/models/gpt-5-4-mini\"\nimport { InferenceResponse } from \"@core/generative-model/inference-response\"\nimport { InputTokenDetails, OutputTokenDetails, TokenUsage } from \"@core/generative-model/token-usage\"\nimport { Tool } from \"@core/generative-model/tool\"\nimport { BaseCondition } from \"@core/context-engine/condition/condition\"\nimport { Action, Rule, If, Loop } from \"@core/context-engine/rule/rule\"\nimport { InMemoryContextRepository } from \"./memory/in-memory-context-repository\"\n\nexport {\n\tContext,\n\tContextItem,\n\tUserMessage,\n\tDeveloperMessage,\n\tModelMessage,\n\tFunctionCall,\n\tFunctionCallOutput,\n\tReasoning,\n\tGenerativeModel,\n\tContextRepository,\n\tInMemoryContextRepository,\n\tOpenAIResponses,\n\tGpt54,\n\tGpt54Mini,\n\tGpt54Nano,\n\tInferenceRequest,\n\tInferenceResponse,\n\tTokenUsage,\n\tInputTokenDetails,\n\tOutputTokenDetails,\n\tTool,\n\tBaseCondition,\n\tAction,\n\tRule,\n\tIf,\n\tLoop,\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class Context {\n\treadonly id: string\n\treadonly projectId: string\n\treadonly items: ContextItem[]\n\n\tconstructor(id: string, projectId: string, items: ContextItem[]) {\n\t\tthis.projectId = projectId\n\t\tthis.id = id\n\t\tthis.items = items\n\t}\n\n\taddItem(item: ContextItem): Context {\n\t\tthis.items.push(item)\n\t\treturn this\n\t}\n\n\tapplyModelOutput(items: ContextItem[]): Context {\n\t\tfor (const item of items) {\n\t\t\tconst itemType = item.getType()\n\t\t\tif (itemType !== \"function_call\" && itemType !== \"message\" && itemType !== \"reasoning\") {\n\t\t\t\tthrow new Error(`Invalid item type: ${itemType}`)\n\t\t\t}\n\t\t}\n\t\tthis.items.push(...items)\n\t\treturn this\n\t}\n\n\tgetItems(): ContextItem[] {\n\t\treturn this.items\n\t}\n\n\tstatic create(projectId: string): Context {\n\t\tconst id = crypto.randomUUID()\n\t\treturn new Context(id, projectId, [])\n\t}\n\n\tstatic rehydrate(data: { id: string; projectId: string; items: ContextItem[] }): Context {\n\t\treturn new Context(data.id, data.projectId, data.items)\n\t}\n\n\ttoJSON(): any {\n\t\treturn this.items.map((item) => item.toJSON())\n\t}\n}\n","export abstract class ContextItem {\n\tabstract readonly type: string\n\n\tgetType(): string {\n\t\treturn this.type\n\t}\n\n\tabstract toJSON(): any\n}\n","export abstract class Content {\n\tabstract readonly type: string\n}\n","import { Content } from \"@core/context-runtime/content\"\n\nexport class InputText extends Content {\n\treadonly type = \"input_text\"\n\n\tprivate constructor(public readonly text: string) {\n\t\tsuper()\n\t}\n\n\tstatic create(text: string): InputText {\n\t\treturn new InputText(text)\n\t}\n\n\tstatic rehydrate(data: { text: string }): InputText {\n\t\treturn new InputText(data.text)\n\t}\n\n\ttoJSON(): any[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttype: this.type,\n\t\t\t\ttext: this.text,\n\t\t\t},\n\t\t]\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\nimport { InputText } from \"@core/context-runtime/content/input-text\"\n\nexport class UserMessage extends ContextItem {\n\treadonly type = \"message\"\n\treadonly role = \"user\"\n\treadonly content: InputText\n\n\tprivate constructor(content: InputText) {\n\t\tsuper()\n\t\tthis.content = content\n\t}\n\n\tstatic create(text: string): UserMessage {\n\t\tconst content = InputText.create(text)\n\t\treturn new UserMessage(content)\n\t}\n\n\tstatic rehydrate(data: { text: string }): UserMessage {\n\t\tconst content = InputText.rehydrate(data)\n\t\treturn new UserMessage(content)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\trole: this.role,\n\t\t\tcontent: this.content.toJSON(),\n\t\t}\n\t}\n}\n","import { InputText } from \"@core/context-runtime/content/input-text\"\nimport { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class DeveloperMessage extends ContextItem {\n\treadonly type = \"message\"\n\treadonly role = \"developer\"\n\treadonly content: InputText\n\n\tprivate constructor(content: InputText) {\n\t\tsuper()\n\t\tthis.content = content\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\trole: this.role,\n\t\t\tcontent: this.content.toJSON(),\n\t\t}\n\t}\n\n\tstatic create(text: string): DeveloperMessage {\n\t\tconst content = InputText.create(text)\n\t\treturn new DeveloperMessage(content)\n\t}\n\n\tstatic rehydrate(data: { text: string }): DeveloperMessage {\n\t\tconst content = InputText.rehydrate(data)\n\t\treturn new DeveloperMessage(content)\n\t}\n}\n","import { Content } from \"@core/context-runtime/content\"\n\nexport class OutputText extends Content {\n\treadonly type = \"output_text\"\n\n\tprivate constructor(public readonly text: string) {\n\t\tsuper()\n\t}\n\n\tstatic rehydrate(data: { text: string }): OutputText {\n\t\treturn new OutputText(data.text)\n\t}\n\n\ttoJSON(): any[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttype: this.type,\n\t\t\t\ttext: this.text,\n\t\t\t},\n\t\t]\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\nimport { OutputText } from \"@core/context-runtime/content/output-text\"\n\nexport class ModelMessage extends ContextItem {\n\treadonly type = \"message\"\n\treadonly role = \"assistant\"\n\treadonly content: OutputText\n\n\tprivate constructor(content: OutputText) {\n\t\tsuper()\n\t\tthis.content = content\n\t}\n\n\tstatic rehydrate(data: { text: string }): ModelMessage {\n\t\tconst content = OutputText.rehydrate(data)\n\t\treturn new ModelMessage(content)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\trole: this.role,\n\t\t\tcontent: this.content.toJSON(),\n\t\t}\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class FunctionCall extends ContextItem {\n\treadonly type = \"function_call\"\n\treadonly callId: string\n\treadonly name: string\n\treadonly args: string\n\n\tprivate constructor(callId: string, name: string, args: string) {\n\t\tsuper()\n\t\tthis.callId = callId\n\t\tthis.name = name\n\t\tthis.args = args\n\t}\n\n\tstatic rehydrate(data: { callId: string; name: string; args: string }): FunctionCall {\n\t\treturn new FunctionCall(data.callId, data.name, data.args)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tcallId: this.callId,\n\t\t\tname: this.name,\n\t\t\targuments: this.args,\n\t\t}\n\t}\n}\n","import { InputText } from \"@core/context-runtime/content/input-text\"\nimport { SummaryText } from \"@core/context-runtime/content/summary-text\"\nimport { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class Reasoning extends ContextItem {\n\treadonly type = \"reasoning\"\n\treadonly content: InputText | undefined\n\treadonly encryptedContent: string | undefined\n\treadonly summary: SummaryText[]\n\n\tprivate constructor(\n\t\tcontent: InputText | undefined,\n\t\tencryptedContent?: string | undefined,\n\t\tsummary: SummaryText[] = [],\n\t) {\n\t\tsuper()\n\t\tthis.content = content\n\t\tthis.encryptedContent = encryptedContent\n\t\tthis.summary = summary\n\t}\n\n\tstatic rehydrate(data: {\n\t\tcontent: InputText | undefined\n\t\tencryptedContent: string | undefined\n\t\tsummary: SummaryText[]\n\t}): Reasoning {\n\t\treturn new Reasoning(data.content, data.encryptedContent, data.summary)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tcontent: this.content?.toJSON(),\n\t\t\tencryptedContent: this.encryptedContent,\n\t\t\tsummary: this.summary.map((s) => s.toJSON()),\n\t\t}\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\nimport { InputText } from \"@core/context-runtime/content/input-text\"\n\nexport class FunctionCallOutput extends ContextItem {\n\treadonly type = \"function_call_output\"\n\treadonly callId: string\n\treadonly output: InputText[]\n\n\tprivate constructor(callId: string, output: InputText[]) {\n\t\tsuper()\n\t\tthis.callId = callId\n\t\tthis.output = output\n\t}\n\n\tstatic create(callId: string, output: InputText[]): FunctionCallOutput {\n\t\treturn new FunctionCallOutput(callId, output)\n\t}\n\n\tstatic rehydrate(data: { callId: string; output: InputText[] }): FunctionCallOutput {\n\t\treturn new FunctionCallOutput(data.callId, data.output)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tcallId: this.callId,\n\t\t\toutput: this.output.map((o) => o.toJSON()),\n\t\t}\n\t}\n}\n","import { ContextItem } from \"src\"\nimport { TokenUsage } from \"./token-usage\"\n\nexport class InferenceResponse {\n\treadonly contextItems: ContextItem[]\n\treadonly tokenUsage?: TokenUsage\n\n\tconstructor(contextItems: ContextItem[], tokenUsage: TokenUsage | undefined) {\n\t\tthis.contextItems = contextItems\n\t\tthis.tokenUsage = tokenUsage\n\t}\n}\n","export class InputTokenDetails {\n\treadonly cached_tokens: number\n\n\tconstructor(cached_tokens: number) {\n\t\tthis.cached_tokens = cached_tokens\n\t}\n}\n\nexport class OutputTokenDetails {\n\treadonly reasoning_tokens: number\n\n\tconstructor(reasoning_tokens: number) {\n\t\tthis.reasoning_tokens = reasoning_tokens\n\t}\n}\n\nexport class TokenUsage {\n\treadonly inputTokens: number\n\treadonly outputTokens: number\n\treadonly totalTokens: number\n\treadonly inputTokenDetails: InputTokenDetails\n\treadonly outputTokenDetails: OutputTokenDetails\n\n\tconstructor(\n\t\tinputTokens: number,\n\t\toutputTokens: number,\n\t\ttotalTokens: number,\n\t\tinputTokenDetails: InputTokenDetails,\n\t\toutputTokenDetails: OutputTokenDetails,\n\t) {\n\t\tthis.inputTokens = inputTokens\n\t\tthis.outputTokens = outputTokens\n\t\tthis.totalTokens = totalTokens\n\t\tthis.inputTokenDetails = inputTokenDetails\n\t\tthis.outputTokenDetails = outputTokenDetails\n\t}\n}\n","import { Context } from \"@core/context-runtime/context\"\nimport { ContextItem } from \"@core/context-runtime/context-item\"\nimport { FunctionCall } from \"@core/context-runtime/output/function-call\"\nimport { ModelMessage } from \"@core/context-runtime/output/model-message\"\nimport { Reasoning } from \"@core/context-runtime/output/reasoning\"\nimport { InferenceRequest } from \"@core/generative-model/inference-request\"\nimport { InferenceResponse } from \"@core/generative-model/inference-response\"\nimport { ModelRuntime } from \"@core/generative-model/runtime/model-runtime\"\nimport { InputTokenDetails, OutputTokenDetails, TokenUsage } from \"@core/generative-model/token-usage\"\nimport OpenAI from \"openai\"\n\nexport class OpenAIResponses implements ModelRuntime {\n\tprivate readonly client: OpenAI\n\tconstructor() {\n\t\tthis.client = new OpenAI()\n\t}\n\n\tasync infer(inferenceRequest: InferenceRequest): Promise<InferenceResponse> {\n\t\tconst input = this.mapContextToRequest(inferenceRequest.context)\n\n\t\tconst specification = inferenceRequest.model.specification\n\n\t\tlet request: any = {\n\t\t\tmodel: specification.name,\n\t\t\tinput: input,\n\t\t}\n\n\t\tif (specification.supportFunctionCalling && inferenceRequest.model.getTools().length > 0) {\n\t\t\trequest.tools = inferenceRequest.model.getTools().map((tool) => {\n\t\t\t\treturn {\n\t\t\t\t\ttype: tool.type,\n\t\t\t\t\tname: tool.name,\n\t\t\t\t\tdescription: tool.description,\n\t\t\t\t\tparameters: tool.parameters,\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tif (specification.supportReasoningEffort) {\n\t\t\trequest.reasoning = {\n\t\t\t\teffort: inferenceRequest.model.getReasoningEffort(),\n\t\t\t}\n\t\t}\n\n\t\tconst response = await this.client.responses.create(request)\n\n\t\tconst contextItems = this.extractContextItems(response)\n\t\tconst tokenUsage = this.extractTokenUsage(response)\n\t\treturn new InferenceResponse(contextItems, tokenUsage)\n\t}\n\n\textractTokenUsage(response: OpenAI.Responses.Response): TokenUsage | undefined {\n\t\tif (!response.usage) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn new TokenUsage(\n\t\t\tresponse.usage.input_tokens,\n\t\t\tresponse.usage.output_tokens,\n\t\t\tresponse.usage.total_tokens,\n\t\t\tnew InputTokenDetails(response.usage.input_tokens_details.cached_tokens),\n\t\t\tnew OutputTokenDetails(response.usage.output_tokens_details.reasoning_tokens),\n\t\t)\n\t}\n\n\tmapContextToRequest(context: Context): any[] {\n\t\treturn context.getItems().map((item) => item.toJSON())\n\t}\n\n\textractContextItems(response: any): ContextItem[] {\n\t\treturn response.output.map((item: any) => {\n\t\t\tif (item.type === \"message\" && item.status === \"completed\") {\n\t\t\t\treturn ModelMessage.rehydrate(item.content[0] as { text: string })\n\t\t\t}\n\t\t\tif (item.type === \"function_call\" && item.status === \"completed\") {\n\t\t\t\treturn FunctionCall.rehydrate(item)\n\t\t\t}\n\t\t\tif (item.type === \"reasoning\") {\n\t\t\t\treturn Reasoning.rehydrate(item)\n\t\t\t}\n\t\t})\n\t}\n}\n","import { Context } from \"@core/context-runtime/context\"\nimport { GenerativeModel } from \"./generative-model\"\nimport { ReasoningEffort } from \"./capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"./capabilities/tool-calling\"\n\nexport class InferenceRequest {\n\treadonly model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability\n\treadonly context: Context\n\n\tconstructor(model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability, context: Context) {\n\t\tthis.model = model\n\t\tthis.context = context\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\n\nexport type OpenAIReasoningEffortType = \"xhigh\" | \"high\" | \"medium\" | \"low\" | \"none\"\n\nexport class OpenAIReasoningEffort implements ReasoningEffort<OpenAIReasoningEffortType> {\n\treasoningEffort: OpenAIReasoningEffortType\n\n\tconstructor(reasoningEffort: OpenAIReasoningEffortType) {\n\t\tthis.reasoningEffort = reasoningEffort\n\t}\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.reasoningEffort = effort\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\tif (!this.reasoningEffort) {\n\t\t\tthrow new Error(\"Reasoning effort not supported\")\n\t\t}\n\t\treturn this.reasoningEffort\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@core/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@core/generative-model/generative-model\"\nimport { Tool } from \"@core/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@openai/reasoning-effort\"\n\nexport class Gpt54Nano implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {\n\treadonly specification = {\n\t\tname: \"gpt-5.4-nano\",\n\t\tsupportReasoningEffort: true,\n\t\tdefaultReasoningEffort: \"none\" as OpenAIReasoningEffortType,\n\t\tsupportStreaming: true,\n\t\tcontextWindowSize: 400_000,\n\t\tmaxOutputTokens: 128_000,\n\t\tsupportFunctionCalling: true,\n\t}\n\n\tprivate tools: Tool[] = []\n\n\tprivate readonly effort: OpenAIReasoningEffort = new OpenAIReasoningEffort(\n\t\tthis.specification.defaultReasoningEffort,\n\t)\n\n\tsetTools(tools: Tool[]): void {\n\t\tthis.tools = tools\n\t}\n\n\tgetTools(): Tool[] {\n\t\treturn this.tools\n\t}\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.effort.setReasoningEffort(effort)\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\treturn this.effort.getReasoningEffort()\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@core/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@core/generative-model/generative-model\"\nimport { Tool } from \"@core/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@openai/reasoning-effort\"\n\nexport class Gpt54 implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {\n\treadonly specification = {\n\t\tname: \"gpt-5.4\",\n\t\tsupportReasoningEffort: true,\n\t\tdefaultReasoningEffort: \"none\" as OpenAIReasoningEffortType,\n\t\tsupportStreaming: true,\n\t\tcontextWindowSize: 1_050_000,\n\t\tmaxOutputTokens: 128_000,\n\t\tsupportFunctionCalling: true,\n\t}\n\n\tprivate tools: Tool[] = []\n\n\tsetTools(tools: Tool[]): void {\n\t\tthis.tools = tools\n\t}\n\n\tgetTools(): Tool[] {\n\t\treturn this.tools\n\t}\n\n\tprivate readonly effort: OpenAIReasoningEffort = new OpenAIReasoningEffort(\n\t\tthis.specification.defaultReasoningEffort,\n\t)\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.effort.setReasoningEffort(effort)\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\treturn this.effort.getReasoningEffort()\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@core/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@core/generative-model/generative-model\"\nimport { Tool } from \"@core/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@openai/reasoning-effort\"\n\nexport class Gpt54Mini implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {\n\treadonly specification = {\n\t\tname: \"gpt-5.4-mini\",\n\t\tsupportReasoningEffort: true,\n\t\tdefaultReasoningEffort: \"none\" as OpenAIReasoningEffortType,\n\t\tsupportStreaming: true,\n\t\tcontextWindowSize: 400_000,\n\t\tmaxOutputTokens: 128_000,\n\t\tsupportFunctionCalling: true,\n\t}\n\n\tprivate tools: Tool[] = []\n\n\tprivate readonly effort: OpenAIReasoningEffort = new OpenAIReasoningEffort(\n\t\tthis.specification.defaultReasoningEffort,\n\t)\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.effort.setReasoningEffort(effort)\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\treturn this.effort.getReasoningEffort()\n\t}\n\n\tsetTools(tools: Tool[]): void {\n\t\tthis.tools = tools\n\t}\n\n\tgetTools(): Tool[] {\n\t\treturn this.tools\n\t}\n}\n","export interface Condition<T> {\n\tisSatisfiedBy(candidate: T): boolean\n\tand(other: Condition<T>): Condition<T>\n\tor(other: Condition<T>): Condition<T>\n\tnot(): Condition<T>\n}\n\nexport abstract class BaseCondition<T> implements Condition<T> {\n\tabstract isSatisfiedBy(candidate: T): boolean\n\n\tand(other: Condition<T>): Condition<T> {\n\t\treturn new AndCondition(this, other)\n\t}\n\n\tor(other: Condition<T>): Condition<T> {\n\t\treturn new OrCondition(this, other)\n\t}\n\n\tnot(): Condition<T> {\n\t\treturn new NotCondition(this)\n\t}\n}\n\nexport class AndCondition<T> extends BaseCondition<T> {\n\tconstructor(\n\t\tprivate readonly left: Condition<T>,\n\t\tprivate readonly right: Condition<T>,\n\t) {\n\t\tsuper()\n\t}\n\n\tisSatisfiedBy(candidate: T): boolean {\n\t\treturn this.left.isSatisfiedBy(candidate) && this.right.isSatisfiedBy(candidate)\n\t}\n}\n\nexport class NotCondition<T> extends BaseCondition<T> {\n\tconstructor(private readonly condition: Condition<T>) {\n\t\tsuper()\n\t}\n\n\tisSatisfiedBy(candidate: T): boolean {\n\t\treturn !this.condition.isSatisfiedBy(candidate)\n\t}\n}\n\nexport class OrCondition<T> extends BaseCondition<T> {\n\tconstructor(\n\t\tprivate readonly left: Condition<T>,\n\t\tprivate readonly right: Condition<T>,\n\t) {\n\t\tsuper()\n\t}\n\n\tisSatisfiedBy(candidate: T): boolean {\n\t\treturn this.left.isSatisfiedBy(candidate) || this.right.isSatisfiedBy(candidate)\n\t}\n}\n","import { Condition } from \"@core/context-engine/condition/condition\"\n\nexport interface Action<T> {\n\tapply(candidate: T): T\n}\n\nexport interface Rule<T> {\n\tcondition: Condition<T>\n\taction: Action<T>\n\tapply(candidate: T): T\n}\n\nexport class If<T> implements Rule<T> {\n\tcondition: Condition<T>\n\taction: Action<T>\n\n\tconstructor({ condition, action }: { condition: Condition<T>; action: Action<T> }) {\n\t\tthis.condition = condition\n\t\tthis.action = action\n\t}\n\n\tapply(candidate: T): T {\n\t\tif (this.condition.isSatisfiedBy(candidate)) {\n\t\t\treturn this.action.apply(candidate)\n\t\t}\n\t\treturn candidate\n\t}\n}\n\nexport class Loop<T> {\n\tprivate condition: Condition<T>\n\tprivate action: Action<T>\n\n\tconstructor({ condition, action }: { condition: Condition<T>; action: Action<T> }) {\n\t\tthis.condition = condition\n\t\tthis.action = action\n\t}\n\n\tapply(candidate: T): T {\n\t\twhile (this.condition.isSatisfiedBy(candidate)) {\n\t\t\tcandidate = this.action.apply(candidate)\n\t\t}\n\t\treturn candidate\n\t}\n}","import { Context } from \"@core/context-runtime/context\"\nimport { ContextRepository } from \"@core/context-runtime/context-repository\"\n\nexport class InMemoryContextRepository implements ContextRepository {\n\tprivate readonly store = new Map<string, Context>()\n\tprivate readonly projectIndex = new Map<string, Set<string>>()\n\n\tasync save(context: Context): Promise<void> {\n\t\tconst existing = this.store.get(context.id)\n\t\tif (existing && existing.projectId !== context.projectId) {\n\t\t\tconst prevSet = this.projectIndex.get(existing.projectId)\n\t\t\tprevSet?.delete(existing.id)\n\t\t\tif (prevSet && prevSet.size === 0) this.projectIndex.delete(existing.projectId)\n\t\t}\n\n\t\tthis.store.set(context.id, this.clone(context))\n\n\t\tlet set = this.projectIndex.get(context.projectId)\n\t\tif (!set) {\n\t\t\tset = new Set<string>()\n\t\t\tthis.projectIndex.set(context.projectId, set)\n\t\t}\n\t\tset.add(context.id)\n\t}\n\n\tasync get(id: string): Promise<Context> {\n\t\tconst context = this.store.get(id)\n\t\tif (!context) {\n\t\t\tthrow new Error(`Context not found: ${id}`)\n\t\t}\n\t\treturn this.clone(context)\n\t}\n\n\tasync getByProjectId(projectId: string): Promise<Context[]> {\n\t\tconst ids = this.projectIndex.get(projectId)\n\t\tif (!ids || ids.size === 0) return []\n\t\treturn [...ids]\n\t\t\t.map((id) => this.store.get(id))\n\t\t\t.filter((c): c is Context => Boolean(c))\n\t\t\t.map((c) => this.clone(c))\n\t}\n\n\tprivate clone(context: Context): Context {\n\t\treturn Context.rehydrate({\n\t\t\tid: context.id,\n\t\t\tprojectId: context.projectId,\n\t\t\titems: [...context.getItems()],\n\t\t})\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAM,UAAN,MAAM,SAAQ;AAAA,EAKpB,YAAY,IAAY,WAAmB,OAAsB;AAChE,SAAK,YAAY;AACjB,SAAK,KAAK;AACV,SAAK,QAAQ;AAAA,EACd;AAAA,EAEA,QAAQ,MAA4B;AACnC,SAAK,MAAM,KAAK,IAAI;AACpB,WAAO;AAAA,EACR;AAAA,EAEA,iBAAiB,OAA+B;AAC/C,eAAW,QAAQ,OAAO;AACzB,YAAM,WAAW,KAAK,QAAQ;AAC9B,UAAI,aAAa,mBAAmB,aAAa,aAAa,aAAa,aAAa;AACvF,cAAM,IAAI,MAAM,sBAAsB,QAAQ,EAAE;AAAA,MACjD;AAAA,IACD;AACA,SA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|
@@ -479,10 +479,10 @@ var OrCondition = class extends BaseCondition {
|
|
|
479
479
|
};
|
|
480
480
|
|
|
481
481
|
// src/core/context-engine/rule/rule.ts
|
|
482
|
-
var
|
|
483
|
-
constructor({
|
|
484
|
-
this.condition =
|
|
485
|
-
this.action =
|
|
482
|
+
var If = class {
|
|
483
|
+
constructor({ condition, action }) {
|
|
484
|
+
this.condition = condition;
|
|
485
|
+
this.action = action;
|
|
486
486
|
}
|
|
487
487
|
apply(candidate) {
|
|
488
488
|
if (this.condition.isSatisfiedBy(candidate)) {
|
|
@@ -491,6 +491,18 @@ var Rule = class {
|
|
|
491
491
|
return candidate;
|
|
492
492
|
}
|
|
493
493
|
};
|
|
494
|
+
var Loop = class {
|
|
495
|
+
constructor({ condition, action }) {
|
|
496
|
+
this.condition = condition;
|
|
497
|
+
this.action = action;
|
|
498
|
+
}
|
|
499
|
+
apply(candidate) {
|
|
500
|
+
while (this.condition.isSatisfiedBy(candidate)) {
|
|
501
|
+
candidate = this.action.apply(candidate);
|
|
502
|
+
}
|
|
503
|
+
return candidate;
|
|
504
|
+
}
|
|
505
|
+
};
|
|
494
506
|
|
|
495
507
|
// src/memory/in-memory-context-repository.ts
|
|
496
508
|
var InMemoryContextRepository = class {
|
|
@@ -543,15 +555,16 @@ export {
|
|
|
543
555
|
Gpt54,
|
|
544
556
|
Gpt54Mini,
|
|
545
557
|
Gpt54Nano,
|
|
558
|
+
If,
|
|
546
559
|
InMemoryContextRepository,
|
|
547
560
|
InferenceRequest,
|
|
548
561
|
InferenceResponse,
|
|
549
562
|
InputTokenDetails,
|
|
563
|
+
Loop,
|
|
550
564
|
ModelMessage,
|
|
551
565
|
OpenAIResponses,
|
|
552
566
|
OutputTokenDetails,
|
|
553
567
|
Reasoning,
|
|
554
|
-
Rule,
|
|
555
568
|
TokenUsage,
|
|
556
569
|
UserMessage
|
|
557
570
|
};
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/context-runtime/context.ts","../src/core/context-runtime/context-item.ts","../src/core/context-runtime/content.ts","../src/core/context-runtime/content/input-text.ts","../src/core/context-runtime/input/user-message.ts","../src/core/context-runtime/input/developer-message.ts","../src/core/context-runtime/content/output-text.ts","../src/core/context-runtime/output/model-message.ts","../src/core/context-runtime/output/function-call.ts","../src/core/context-runtime/output/reasoning.ts","../src/core/context-runtime/input/function-call-output.ts","../src/core/generative-model/inference-response.ts","../src/core/generative-model/token-usage.ts","../src/providers/openai/runtime/openai-responses.ts","../src/core/generative-model/inference-request.ts","../src/providers/openai/reasoning-effort.ts","../src/providers/openai/models/gpt-5-4-nano.ts","../src/providers/openai/models/gpt-5-4.ts","../src/providers/openai/models/gpt-5-4-mini.ts","../src/core/context-engine/condition/condition.ts","../src/core/context-engine/rule/rule.ts","../src/memory/in-memory-context-repository.ts"],"sourcesContent":["import { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class Context {\n\treadonly id: string\n\treadonly projectId: string\n\treadonly items: ContextItem[]\n\n\tconstructor(id: string, projectId: string, items: ContextItem[]) {\n\t\tthis.projectId = projectId\n\t\tthis.id = id\n\t\tthis.items = items\n\t}\n\n\taddItem(item: ContextItem): Context {\n\t\tthis.items.push(item)\n\t\treturn this\n\t}\n\n\tapplyModelOutput(items: ContextItem[]): Context {\n\t\tfor (const item of items) {\n\t\t\tconst itemType = item.getType()\n\t\t\tif (itemType !== \"function_call\" && itemType !== \"message\" && itemType !== \"reasoning\") {\n\t\t\t\tthrow new Error(`Invalid item type: ${itemType}`)\n\t\t\t}\n\t\t}\n\t\tthis.items.push(...items)\n\t\treturn this\n\t}\n\n\tgetItems(): ContextItem[] {\n\t\treturn this.items\n\t}\n\n\tstatic create(projectId: string): Context {\n\t\tconst id = crypto.randomUUID()\n\t\treturn new Context(id, projectId, [])\n\t}\n\n\tstatic rehydrate(data: { id: string; projectId: string; items: ContextItem[] }): Context {\n\t\treturn new Context(data.id, data.projectId, data.items)\n\t}\n\n\ttoJSON(): any {\n\t\treturn this.items.map((item) => item.toJSON())\n\t}\n}\n","export abstract class ContextItem {\n\tabstract readonly type: string\n\n\tgetType(): string {\n\t\treturn this.type\n\t}\n\n\tabstract toJSON(): any\n}\n","export abstract class Content {\n\tabstract readonly type: string\n}\n","import { Content } from \"@core/context-runtime/content\"\n\nexport class InputText extends Content {\n\treadonly type = \"input_text\"\n\n\tprivate constructor(public readonly text: string) {\n\t\tsuper()\n\t}\n\n\tstatic create(text: string): InputText {\n\t\treturn new InputText(text)\n\t}\n\n\tstatic rehydrate(data: { text: string }): InputText {\n\t\treturn new InputText(data.text)\n\t}\n\n\ttoJSON(): any[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttype: this.type,\n\t\t\t\ttext: this.text,\n\t\t\t},\n\t\t]\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\nimport { InputText } from \"@core/context-runtime/content/input-text\"\n\nexport class UserMessage extends ContextItem {\n\treadonly type = \"message\"\n\treadonly role = \"user\"\n\treadonly content: InputText\n\n\tprivate constructor(content: InputText) {\n\t\tsuper()\n\t\tthis.content = content\n\t}\n\n\tstatic create(text: string): UserMessage {\n\t\tconst content = InputText.create(text)\n\t\treturn new UserMessage(content)\n\t}\n\n\tstatic rehydrate(data: { text: string }): UserMessage {\n\t\tconst content = InputText.rehydrate(data)\n\t\treturn new UserMessage(content)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\trole: this.role,\n\t\t\tcontent: this.content.toJSON(),\n\t\t}\n\t}\n}\n","import { InputText } from \"@core/context-runtime/content/input-text\"\nimport { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class DeveloperMessage extends ContextItem {\n\treadonly type = \"message\"\n\treadonly role = \"developer\"\n\treadonly content: InputText\n\n\tprivate constructor(content: InputText) {\n\t\tsuper()\n\t\tthis.content = content\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\trole: this.role,\n\t\t\tcontent: this.content.toJSON(),\n\t\t}\n\t}\n\n\tstatic create(text: string): DeveloperMessage {\n\t\tconst content = InputText.create(text)\n\t\treturn new DeveloperMessage(content)\n\t}\n\n\tstatic rehydrate(data: { text: string }): DeveloperMessage {\n\t\tconst content = InputText.rehydrate(data)\n\t\treturn new DeveloperMessage(content)\n\t}\n}\n","import { Content } from \"@core/context-runtime/content\"\n\nexport class OutputText extends Content {\n\treadonly type = \"output_text\"\n\n\tprivate constructor(public readonly text: string) {\n\t\tsuper()\n\t}\n\n\tstatic rehydrate(data: { text: string }): OutputText {\n\t\treturn new OutputText(data.text)\n\t}\n\n\ttoJSON(): any[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttype: this.type,\n\t\t\t\ttext: this.text,\n\t\t\t},\n\t\t]\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\nimport { OutputText } from \"@core/context-runtime/content/output-text\"\n\nexport class ModelMessage extends ContextItem {\n\treadonly type = \"message\"\n\treadonly role = \"assistant\"\n\treadonly content: OutputText\n\n\tprivate constructor(content: OutputText) {\n\t\tsuper()\n\t\tthis.content = content\n\t}\n\n\tstatic rehydrate(data: { text: string }): ModelMessage {\n\t\tconst content = OutputText.rehydrate(data)\n\t\treturn new ModelMessage(content)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\trole: this.role,\n\t\t\tcontent: this.content.toJSON(),\n\t\t}\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class FunctionCall extends ContextItem {\n\treadonly type = \"function_call\"\n\treadonly callId: string\n\treadonly name: string\n\treadonly args: string\n\n\tprivate constructor(callId: string, name: string, args: string) {\n\t\tsuper()\n\t\tthis.callId = callId\n\t\tthis.name = name\n\t\tthis.args = args\n\t}\n\n\tstatic rehydrate(data: { callId: string; name: string; args: string }): FunctionCall {\n\t\treturn new FunctionCall(data.callId, data.name, data.args)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tcallId: this.callId,\n\t\t\tname: this.name,\n\t\t\targuments: this.args,\n\t\t}\n\t}\n}\n","import { InputText } from \"@core/context-runtime/content/input-text\"\nimport { SummaryText } from \"@core/context-runtime/content/summary-text\"\nimport { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class Reasoning extends ContextItem {\n\treadonly type = \"reasoning\"\n\treadonly content: InputText | undefined\n\treadonly encryptedContent: string | undefined\n\treadonly summary: SummaryText[]\n\n\tprivate constructor(\n\t\tcontent: InputText | undefined,\n\t\tencryptedContent?: string | undefined,\n\t\tsummary: SummaryText[] = [],\n\t) {\n\t\tsuper()\n\t\tthis.content = content\n\t\tthis.encryptedContent = encryptedContent\n\t\tthis.summary = summary\n\t}\n\n\tstatic rehydrate(data: {\n\t\tcontent: InputText | undefined\n\t\tencryptedContent: string | undefined\n\t\tsummary: SummaryText[]\n\t}): Reasoning {\n\t\treturn new Reasoning(data.content, data.encryptedContent, data.summary)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tcontent: this.content?.toJSON(),\n\t\t\tencryptedContent: this.encryptedContent,\n\t\t\tsummary: this.summary.map((s) => s.toJSON()),\n\t\t}\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\nimport { InputText } from \"@core/context-runtime/content/input-text\"\n\nexport class FunctionCallOutput extends ContextItem {\n\treadonly type = \"function_call_output\"\n\treadonly callId: string\n\treadonly output: InputText[]\n\n\tprivate constructor(callId: string, output: InputText[]) {\n\t\tsuper()\n\t\tthis.callId = callId\n\t\tthis.output = output\n\t}\n\n\tstatic create(callId: string, output: InputText[]): FunctionCallOutput {\n\t\treturn new FunctionCallOutput(callId, output)\n\t}\n\n\tstatic rehydrate(data: { callId: string; output: InputText[] }): FunctionCallOutput {\n\t\treturn new FunctionCallOutput(data.callId, data.output)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tcallId: this.callId,\n\t\t\toutput: this.output.map((o) => o.toJSON()),\n\t\t}\n\t}\n}\n","import { ContextItem } from \"src\"\nimport { TokenUsage } from \"./token-usage\"\n\nexport class InferenceResponse {\n\treadonly contextItems: ContextItem[]\n\treadonly tokenUsage?: TokenUsage\n\n\tconstructor(contextItems: ContextItem[], tokenUsage: TokenUsage | undefined) {\n\t\tthis.contextItems = contextItems\n\t\tthis.tokenUsage = tokenUsage\n\t}\n}\n","export class InputTokenDetails {\n\treadonly cached_tokens: number\n\n\tconstructor(cached_tokens: number) {\n\t\tthis.cached_tokens = cached_tokens\n\t}\n}\n\nexport class OutputTokenDetails {\n\treadonly reasoning_tokens: number\n\n\tconstructor(reasoning_tokens: number) {\n\t\tthis.reasoning_tokens = reasoning_tokens\n\t}\n}\n\nexport class TokenUsage {\n\treadonly inputTokens: number\n\treadonly outputTokens: number\n\treadonly totalTokens: number\n\treadonly inputTokenDetails: InputTokenDetails\n\treadonly outputTokenDetails: OutputTokenDetails\n\n\tconstructor(\n\t\tinputTokens: number,\n\t\toutputTokens: number,\n\t\ttotalTokens: number,\n\t\tinputTokenDetails: InputTokenDetails,\n\t\toutputTokenDetails: OutputTokenDetails,\n\t) {\n\t\tthis.inputTokens = inputTokens\n\t\tthis.outputTokens = outputTokens\n\t\tthis.totalTokens = totalTokens\n\t\tthis.inputTokenDetails = inputTokenDetails\n\t\tthis.outputTokenDetails = outputTokenDetails\n\t}\n}\n","import { Context } from \"@core/context-runtime/context\"\nimport { ContextItem } from \"@core/context-runtime/context-item\"\nimport { FunctionCall } from \"@core/context-runtime/output/function-call\"\nimport { ModelMessage } from \"@core/context-runtime/output/model-message\"\nimport { Reasoning } from \"@core/context-runtime/output/reasoning\"\nimport { InferenceRequest } from \"@core/generative-model/inference-request\"\nimport { InferenceResponse } from \"@core/generative-model/inference-response\"\nimport { ModelRuntime } from \"@core/generative-model/runtime/model-runtime\"\nimport { InputTokenDetails, OutputTokenDetails, TokenUsage } from \"@core/generative-model/token-usage\"\nimport OpenAI from \"openai\"\n\nexport class OpenAIResponses implements ModelRuntime {\n\tprivate readonly client: OpenAI\n\tconstructor() {\n\t\tthis.client = new OpenAI()\n\t}\n\n\tasync infer(inferenceRequest: InferenceRequest): Promise<InferenceResponse> {\n\t\tconst input = this.mapContextToRequest(inferenceRequest.context)\n\n\t\tconst specification = inferenceRequest.model.specification\n\n\t\tlet request: any = {\n\t\t\tmodel: specification.name,\n\t\t\tinput: input,\n\t\t}\n\n\t\tif (specification.supportFunctionCalling && inferenceRequest.model.getTools().length > 0) {\n\t\t\trequest.tools = inferenceRequest.model.getTools().map((tool) => {\n\t\t\t\treturn {\n\t\t\t\t\ttype: tool.type,\n\t\t\t\t\tname: tool.name,\n\t\t\t\t\tdescription: tool.description,\n\t\t\t\t\tparameters: tool.parameters,\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tif (specification.supportReasoningEffort) {\n\t\t\trequest.reasoning = {\n\t\t\t\teffort: inferenceRequest.model.getReasoningEffort(),\n\t\t\t}\n\t\t}\n\n\t\tconst response = await this.client.responses.create(request)\n\n\t\tconst contextItems = this.extractContextItems(response)\n\t\tconst tokenUsage = this.extractTokenUsage(response)\n\t\treturn new InferenceResponse(contextItems, tokenUsage)\n\t}\n\n\textractTokenUsage(response: OpenAI.Responses.Response): TokenUsage | undefined {\n\t\tif (!response.usage) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn new TokenUsage(\n\t\t\tresponse.usage.input_tokens,\n\t\t\tresponse.usage.output_tokens,\n\t\t\tresponse.usage.total_tokens,\n\t\t\tnew InputTokenDetails(response.usage.input_tokens_details.cached_tokens),\n\t\t\tnew OutputTokenDetails(response.usage.output_tokens_details.reasoning_tokens),\n\t\t)\n\t}\n\n\tmapContextToRequest(context: Context): any[] {\n\t\treturn context.getItems().map((item) => item.toJSON())\n\t}\n\n\textractContextItems(response: any): ContextItem[] {\n\t\treturn response.output.map((item: any) => {\n\t\t\tif (item.type === \"message\" && item.status === \"completed\") {\n\t\t\t\treturn ModelMessage.rehydrate(item.content[0] as { text: string })\n\t\t\t}\n\t\t\tif (item.type === \"function_call\" && item.status === \"completed\") {\n\t\t\t\treturn FunctionCall.rehydrate(item)\n\t\t\t}\n\t\t\tif (item.type === \"reasoning\") {\n\t\t\t\treturn Reasoning.rehydrate(item)\n\t\t\t}\n\t\t})\n\t}\n}\n","import { Context } from \"@core/context-runtime/context\"\nimport { GenerativeModel } from \"./generative-model\"\nimport { ReasoningEffort } from \"./capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"./capabilities/tool-calling\"\n\nexport class InferenceRequest {\n\treadonly model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability\n\treadonly context: Context\n\n\tconstructor(model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability, context: Context) {\n\t\tthis.model = model\n\t\tthis.context = context\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\n\nexport type OpenAIReasoningEffortType = \"xhigh\" | \"high\" | \"medium\" | \"low\" | \"none\"\n\nexport class OpenAIReasoningEffort implements ReasoningEffort<OpenAIReasoningEffortType> {\n\treasoningEffort: OpenAIReasoningEffortType\n\n\tconstructor(reasoningEffort: OpenAIReasoningEffortType) {\n\t\tthis.reasoningEffort = reasoningEffort\n\t}\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.reasoningEffort = effort\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\tif (!this.reasoningEffort) {\n\t\t\tthrow new Error(\"Reasoning effort not supported\")\n\t\t}\n\t\treturn this.reasoningEffort\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@core/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@core/generative-model/generative-model\"\nimport { Tool } from \"@core/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@openai/reasoning-effort\"\n\nexport class Gpt54Nano implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {\n\treadonly specification = {\n\t\tname: \"gpt-5.4-nano\",\n\t\tsupportReasoningEffort: true,\n\t\tdefaultReasoningEffort: \"none\" as OpenAIReasoningEffortType,\n\t\tsupportStreaming: true,\n\t\tcontextWindowSize: 400_000,\n\t\tmaxOutputTokens: 128_000,\n\t\tsupportFunctionCalling: true,\n\t}\n\n\tprivate tools: Tool[] = []\n\n\tprivate readonly effort: OpenAIReasoningEffort = new OpenAIReasoningEffort(\n\t\tthis.specification.defaultReasoningEffort,\n\t)\n\n\tsetTools(tools: Tool[]): void {\n\t\tthis.tools = tools\n\t}\n\n\tgetTools(): Tool[] {\n\t\treturn this.tools\n\t}\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.effort.setReasoningEffort(effort)\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\treturn this.effort.getReasoningEffort()\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@core/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@core/generative-model/generative-model\"\nimport { Tool } from \"@core/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@openai/reasoning-effort\"\n\nexport class Gpt54 implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {\n\treadonly specification = {\n\t\tname: \"gpt-5.4\",\n\t\tsupportReasoningEffort: true,\n\t\tdefaultReasoningEffort: \"none\" as OpenAIReasoningEffortType,\n\t\tsupportStreaming: true,\n\t\tcontextWindowSize: 1_050_000,\n\t\tmaxOutputTokens: 128_000,\n\t\tsupportFunctionCalling: true,\n\t}\n\n\tprivate tools: Tool[] = []\n\n\tsetTools(tools: Tool[]): void {\n\t\tthis.tools = tools\n\t}\n\n\tgetTools(): Tool[] {\n\t\treturn this.tools\n\t}\n\n\tprivate readonly effort: OpenAIReasoningEffort = new OpenAIReasoningEffort(\n\t\tthis.specification.defaultReasoningEffort,\n\t)\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.effort.setReasoningEffort(effort)\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\treturn this.effort.getReasoningEffort()\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@core/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@core/generative-model/generative-model\"\nimport { Tool } from \"@core/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@openai/reasoning-effort\"\n\nexport class Gpt54Mini implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {\n\treadonly specification = {\n\t\tname: \"gpt-5.4-mini\",\n\t\tsupportReasoningEffort: true,\n\t\tdefaultReasoningEffort: \"none\" as OpenAIReasoningEffortType,\n\t\tsupportStreaming: true,\n\t\tcontextWindowSize: 400_000,\n\t\tmaxOutputTokens: 128_000,\n\t\tsupportFunctionCalling: true,\n\t}\n\n\tprivate tools: Tool[] = []\n\n\tprivate readonly effort: OpenAIReasoningEffort = new OpenAIReasoningEffort(\n\t\tthis.specification.defaultReasoningEffort,\n\t)\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.effort.setReasoningEffort(effort)\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\treturn this.effort.getReasoningEffort()\n\t}\n\n\tsetTools(tools: Tool[]): void {\n\t\tthis.tools = tools\n\t}\n\n\tgetTools(): Tool[] {\n\t\treturn this.tools\n\t}\n}\n","export interface Condition<T> {\n\tisSatisfiedBy(candidate: T): boolean\n\tand(other: Condition<T>): Condition<T>\n\tor(other: Condition<T>): Condition<T>\n\tnot(): Condition<T>\n}\n\nexport abstract class BaseCondition<T> implements Condition<T> {\n\tabstract isSatisfiedBy(candidate: T): boolean\n\n\tand(other: Condition<T>): Condition<T> {\n\t\treturn new AndCondition(this, other)\n\t}\n\n\tor(other: Condition<T>): Condition<T> {\n\t\treturn new OrCondition(this, other)\n\t}\n\n\tnot(): Condition<T> {\n\t\treturn new NotCondition(this)\n\t}\n}\n\nexport class AndCondition<T> extends BaseCondition<T> {\n\tconstructor(\n\t\tprivate readonly left: Condition<T>,\n\t\tprivate readonly right: Condition<T>,\n\t) {\n\t\tsuper()\n\t}\n\n\tisSatisfiedBy(candidate: T): boolean {\n\t\treturn this.left.isSatisfiedBy(candidate) && this.right.isSatisfiedBy(candidate)\n\t}\n}\n\nexport class NotCondition<T> extends BaseCondition<T> {\n\tconstructor(private readonly condition: Condition<T>) {\n\t\tsuper()\n\t}\n\n\tisSatisfiedBy(candidate: T): boolean {\n\t\treturn !this.condition.isSatisfiedBy(candidate)\n\t}\n}\n\nexport class OrCondition<T> extends BaseCondition<T> {\n\tconstructor(\n\t\tprivate readonly left: Condition<T>,\n\t\tprivate readonly right: Condition<T>,\n\t) {\n\t\tsuper()\n\t}\n\n\tisSatisfiedBy(candidate: T): boolean {\n\t\treturn this.left.isSatisfiedBy(candidate) || this.right.isSatisfiedBy(candidate)\n\t}\n}\n","import { Condition } from \"@core/context-engine/condition/condition\"\n\nexport interface Action<T> {\n\tapply(candidate: T): T\n}\n\nexport class Rule<T> {\n\tprivate condition: Condition<T>\n\tprivate action: Action<T>\n\n\tconstructor({ when, then }: { when: Condition<T>; then: Action<T> }) {\n\t\tthis.condition = when\t\n\t\tthis.action = then\n\t}\n\n\tapply(candidate: T): T {\n\t\tif (this.condition.isSatisfiedBy(candidate)) {\n\t\t\treturn this.action.apply(candidate)\n\t\t}\n\t\treturn candidate\n\t}\n}\n","import { Context } from \"@core/context-runtime/context\"\nimport { ContextRepository } from \"@core/context-runtime/context-repository\"\n\nexport class InMemoryContextRepository implements ContextRepository {\n\tprivate readonly store = new Map<string, Context>()\n\tprivate readonly projectIndex = new Map<string, Set<string>>()\n\n\tasync save(context: Context): Promise<void> {\n\t\tconst existing = this.store.get(context.id)\n\t\tif (existing && existing.projectId !== context.projectId) {\n\t\t\tconst prevSet = this.projectIndex.get(existing.projectId)\n\t\t\tprevSet?.delete(existing.id)\n\t\t\tif (prevSet && prevSet.size === 0) this.projectIndex.delete(existing.projectId)\n\t\t}\n\n\t\tthis.store.set(context.id, this.clone(context))\n\n\t\tlet set = this.projectIndex.get(context.projectId)\n\t\tif (!set) {\n\t\t\tset = new Set<string>()\n\t\t\tthis.projectIndex.set(context.projectId, set)\n\t\t}\n\t\tset.add(context.id)\n\t}\n\n\tasync get(id: string): Promise<Context> {\n\t\tconst context = this.store.get(id)\n\t\tif (!context) {\n\t\t\tthrow new Error(`Context not found: ${id}`)\n\t\t}\n\t\treturn this.clone(context)\n\t}\n\n\tasync getByProjectId(projectId: string): Promise<Context[]> {\n\t\tconst ids = this.projectIndex.get(projectId)\n\t\tif (!ids || ids.size === 0) return []\n\t\treturn [...ids]\n\t\t\t.map((id) => this.store.get(id))\n\t\t\t.filter((c): c is Context => Boolean(c))\n\t\t\t.map((c) => this.clone(c))\n\t}\n\n\tprivate clone(context: Context): Context {\n\t\treturn Context.rehydrate({\n\t\t\tid: context.id,\n\t\t\tprojectId: context.projectId,\n\t\t\titems: [...context.getItems()],\n\t\t})\n\t}\n}\n"],"mappings":";AAEO,IAAM,UAAN,MAAM,SAAQ;AAAA,EAKpB,YAAY,IAAY,WAAmB,OAAsB;AAChE,SAAK,YAAY;AACjB,SAAK,KAAK;AACV,SAAK,QAAQ;AAAA,EACd;AAAA,EAEA,QAAQ,MAA4B;AACnC,SAAK,MAAM,KAAK,IAAI;AACpB,WAAO;AAAA,EACR;AAAA,EAEA,iBAAiB,OAA+B;AAC/C,eAAW,QAAQ,OAAO;AACzB,YAAM,WAAW,KAAK,QAAQ;AAC9B,UAAI,aAAa,mBAAmB,aAAa,aAAa,aAAa,aAAa;AACvF,cAAM,IAAI,MAAM,sBAAsB,QAAQ,EAAE;AAAA,MACjD;AAAA,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,QAAQ,IAAI,KAAK,MAAM,OAAO,CAAC;AAE9C,QAAI,MAAM,KAAK,aAAa,IAAI,QAAQ,SAAS;AACjD,QAAI,CAAC,KAAK;AACT,YAAM,oBAAI,IAAY;AACtB,WAAK,aAAa,IAAI,QAAQ,WAAW,GAAG;AAAA,IAC7C;AACA,QAAI,IAAI,QAAQ,EAAE;AAAA,EACnB;AAAA,EAEA,MAAM,IAAI,IAA8B;AACvC,UAAM,UAAU,KAAK,MAAM,IAAI,EAAE;AACjC,QAAI,CAAC,SAAS;AACb,YAAM,IAAI,MAAM,sBAAsB,EAAE,EAAE;AAAA,IAC3C;AACA,WAAO,KAAK,MAAM,OAAO;AAAA,EAC1B;AAAA,EAEA,MAAM,eAAe,WAAuC;AAC3D,UAAM,MAAM,KAAK,aAAa,IAAI,SAAS;AAC3C,QAAI,CAAC,OAAO,IAAI,SAAS,EAAG,QAAO,CAAC;AACpC,WAAO,CAAC,GAAG,GAAG,EACZ,IAAI,CAAC,OAAO,KAAK,MAAM,IAAI,EAAE,CAAC,EAC9B,OAAO,CAAC,MAAoB,QAAQ,CAAC,CAAC,EACtC,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;AAAA,EAC3B;AAAA,EAEQ,MAAM,SAA2B;AACxC,WAAO,QAAQ,UAAU;AAAA,MACxB,IAAI,QAAQ;AAAA,MACZ,WAAW,QAAQ;AAAA,MACnB,OAAO,CAAC,GAAG,QAAQ,SAAS,CAAC;AAAA,IAC9B,CAAC;AAAA,EACF;AACD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/core/context-runtime/context.ts","../src/core/context-runtime/context-item.ts","../src/core/context-runtime/content.ts","../src/core/context-runtime/content/input-text.ts","../src/core/context-runtime/input/user-message.ts","../src/core/context-runtime/input/developer-message.ts","../src/core/context-runtime/content/output-text.ts","../src/core/context-runtime/output/model-message.ts","../src/core/context-runtime/output/function-call.ts","../src/core/context-runtime/output/reasoning.ts","../src/core/context-runtime/input/function-call-output.ts","../src/core/generative-model/inference-response.ts","../src/core/generative-model/token-usage.ts","../src/providers/openai/runtime/openai-responses.ts","../src/core/generative-model/inference-request.ts","../src/providers/openai/reasoning-effort.ts","../src/providers/openai/models/gpt-5-4-nano.ts","../src/providers/openai/models/gpt-5-4.ts","../src/providers/openai/models/gpt-5-4-mini.ts","../src/core/context-engine/condition/condition.ts","../src/core/context-engine/rule/rule.ts","../src/memory/in-memory-context-repository.ts"],"sourcesContent":["import { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class Context {\n\treadonly id: string\n\treadonly projectId: string\n\treadonly items: ContextItem[]\n\n\tconstructor(id: string, projectId: string, items: ContextItem[]) {\n\t\tthis.projectId = projectId\n\t\tthis.id = id\n\t\tthis.items = items\n\t}\n\n\taddItem(item: ContextItem): Context {\n\t\tthis.items.push(item)\n\t\treturn this\n\t}\n\n\tapplyModelOutput(items: ContextItem[]): Context {\n\t\tfor (const item of items) {\n\t\t\tconst itemType = item.getType()\n\t\t\tif (itemType !== \"function_call\" && itemType !== \"message\" && itemType !== \"reasoning\") {\n\t\t\t\tthrow new Error(`Invalid item type: ${itemType}`)\n\t\t\t}\n\t\t}\n\t\tthis.items.push(...items)\n\t\treturn this\n\t}\n\n\tgetItems(): ContextItem[] {\n\t\treturn this.items\n\t}\n\n\tstatic create(projectId: string): Context {\n\t\tconst id = crypto.randomUUID()\n\t\treturn new Context(id, projectId, [])\n\t}\n\n\tstatic rehydrate(data: { id: string; projectId: string; items: ContextItem[] }): Context {\n\t\treturn new Context(data.id, data.projectId, data.items)\n\t}\n\n\ttoJSON(): any {\n\t\treturn this.items.map((item) => item.toJSON())\n\t}\n}\n","export abstract class ContextItem {\n\tabstract readonly type: string\n\n\tgetType(): string {\n\t\treturn this.type\n\t}\n\n\tabstract toJSON(): any\n}\n","export abstract class Content {\n\tabstract readonly type: string\n}\n","import { Content } from \"@core/context-runtime/content\"\n\nexport class InputText extends Content {\n\treadonly type = \"input_text\"\n\n\tprivate constructor(public readonly text: string) {\n\t\tsuper()\n\t}\n\n\tstatic create(text: string): InputText {\n\t\treturn new InputText(text)\n\t}\n\n\tstatic rehydrate(data: { text: string }): InputText {\n\t\treturn new InputText(data.text)\n\t}\n\n\ttoJSON(): any[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttype: this.type,\n\t\t\t\ttext: this.text,\n\t\t\t},\n\t\t]\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\nimport { InputText } from \"@core/context-runtime/content/input-text\"\n\nexport class UserMessage extends ContextItem {\n\treadonly type = \"message\"\n\treadonly role = \"user\"\n\treadonly content: InputText\n\n\tprivate constructor(content: InputText) {\n\t\tsuper()\n\t\tthis.content = content\n\t}\n\n\tstatic create(text: string): UserMessage {\n\t\tconst content = InputText.create(text)\n\t\treturn new UserMessage(content)\n\t}\n\n\tstatic rehydrate(data: { text: string }): UserMessage {\n\t\tconst content = InputText.rehydrate(data)\n\t\treturn new UserMessage(content)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\trole: this.role,\n\t\t\tcontent: this.content.toJSON(),\n\t\t}\n\t}\n}\n","import { InputText } from \"@core/context-runtime/content/input-text\"\nimport { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class DeveloperMessage extends ContextItem {\n\treadonly type = \"message\"\n\treadonly role = \"developer\"\n\treadonly content: InputText\n\n\tprivate constructor(content: InputText) {\n\t\tsuper()\n\t\tthis.content = content\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\trole: this.role,\n\t\t\tcontent: this.content.toJSON(),\n\t\t}\n\t}\n\n\tstatic create(text: string): DeveloperMessage {\n\t\tconst content = InputText.create(text)\n\t\treturn new DeveloperMessage(content)\n\t}\n\n\tstatic rehydrate(data: { text: string }): DeveloperMessage {\n\t\tconst content = InputText.rehydrate(data)\n\t\treturn new DeveloperMessage(content)\n\t}\n}\n","import { Content } from \"@core/context-runtime/content\"\n\nexport class OutputText extends Content {\n\treadonly type = \"output_text\"\n\n\tprivate constructor(public readonly text: string) {\n\t\tsuper()\n\t}\n\n\tstatic rehydrate(data: { text: string }): OutputText {\n\t\treturn new OutputText(data.text)\n\t}\n\n\ttoJSON(): any[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttype: this.type,\n\t\t\t\ttext: this.text,\n\t\t\t},\n\t\t]\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\nimport { OutputText } from \"@core/context-runtime/content/output-text\"\n\nexport class ModelMessage extends ContextItem {\n\treadonly type = \"message\"\n\treadonly role = \"assistant\"\n\treadonly content: OutputText\n\n\tprivate constructor(content: OutputText) {\n\t\tsuper()\n\t\tthis.content = content\n\t}\n\n\tstatic rehydrate(data: { text: string }): ModelMessage {\n\t\tconst content = OutputText.rehydrate(data)\n\t\treturn new ModelMessage(content)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\trole: this.role,\n\t\t\tcontent: this.content.toJSON(),\n\t\t}\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class FunctionCall extends ContextItem {\n\treadonly type = \"function_call\"\n\treadonly callId: string\n\treadonly name: string\n\treadonly args: string\n\n\tprivate constructor(callId: string, name: string, args: string) {\n\t\tsuper()\n\t\tthis.callId = callId\n\t\tthis.name = name\n\t\tthis.args = args\n\t}\n\n\tstatic rehydrate(data: { callId: string; name: string; args: string }): FunctionCall {\n\t\treturn new FunctionCall(data.callId, data.name, data.args)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tcallId: this.callId,\n\t\t\tname: this.name,\n\t\t\targuments: this.args,\n\t\t}\n\t}\n}\n","import { InputText } from \"@core/context-runtime/content/input-text\"\nimport { SummaryText } from \"@core/context-runtime/content/summary-text\"\nimport { ContextItem } from \"@core/context-runtime/context-item\"\n\nexport class Reasoning extends ContextItem {\n\treadonly type = \"reasoning\"\n\treadonly content: InputText | undefined\n\treadonly encryptedContent: string | undefined\n\treadonly summary: SummaryText[]\n\n\tprivate constructor(\n\t\tcontent: InputText | undefined,\n\t\tencryptedContent?: string | undefined,\n\t\tsummary: SummaryText[] = [],\n\t) {\n\t\tsuper()\n\t\tthis.content = content\n\t\tthis.encryptedContent = encryptedContent\n\t\tthis.summary = summary\n\t}\n\n\tstatic rehydrate(data: {\n\t\tcontent: InputText | undefined\n\t\tencryptedContent: string | undefined\n\t\tsummary: SummaryText[]\n\t}): Reasoning {\n\t\treturn new Reasoning(data.content, data.encryptedContent, data.summary)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tcontent: this.content?.toJSON(),\n\t\t\tencryptedContent: this.encryptedContent,\n\t\t\tsummary: this.summary.map((s) => s.toJSON()),\n\t\t}\n\t}\n}\n","import { ContextItem } from \"@core/context-runtime/context-item\"\nimport { InputText } from \"@core/context-runtime/content/input-text\"\n\nexport class FunctionCallOutput extends ContextItem {\n\treadonly type = \"function_call_output\"\n\treadonly callId: string\n\treadonly output: InputText[]\n\n\tprivate constructor(callId: string, output: InputText[]) {\n\t\tsuper()\n\t\tthis.callId = callId\n\t\tthis.output = output\n\t}\n\n\tstatic create(callId: string, output: InputText[]): FunctionCallOutput {\n\t\treturn new FunctionCallOutput(callId, output)\n\t}\n\n\tstatic rehydrate(data: { callId: string; output: InputText[] }): FunctionCallOutput {\n\t\treturn new FunctionCallOutput(data.callId, data.output)\n\t}\n\n\ttoJSON(): any {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tcallId: this.callId,\n\t\t\toutput: this.output.map((o) => o.toJSON()),\n\t\t}\n\t}\n}\n","import { ContextItem } from \"src\"\nimport { TokenUsage } from \"./token-usage\"\n\nexport class InferenceResponse {\n\treadonly contextItems: ContextItem[]\n\treadonly tokenUsage?: TokenUsage\n\n\tconstructor(contextItems: ContextItem[], tokenUsage: TokenUsage | undefined) {\n\t\tthis.contextItems = contextItems\n\t\tthis.tokenUsage = tokenUsage\n\t}\n}\n","export class InputTokenDetails {\n\treadonly cached_tokens: number\n\n\tconstructor(cached_tokens: number) {\n\t\tthis.cached_tokens = cached_tokens\n\t}\n}\n\nexport class OutputTokenDetails {\n\treadonly reasoning_tokens: number\n\n\tconstructor(reasoning_tokens: number) {\n\t\tthis.reasoning_tokens = reasoning_tokens\n\t}\n}\n\nexport class TokenUsage {\n\treadonly inputTokens: number\n\treadonly outputTokens: number\n\treadonly totalTokens: number\n\treadonly inputTokenDetails: InputTokenDetails\n\treadonly outputTokenDetails: OutputTokenDetails\n\n\tconstructor(\n\t\tinputTokens: number,\n\t\toutputTokens: number,\n\t\ttotalTokens: number,\n\t\tinputTokenDetails: InputTokenDetails,\n\t\toutputTokenDetails: OutputTokenDetails,\n\t) {\n\t\tthis.inputTokens = inputTokens\n\t\tthis.outputTokens = outputTokens\n\t\tthis.totalTokens = totalTokens\n\t\tthis.inputTokenDetails = inputTokenDetails\n\t\tthis.outputTokenDetails = outputTokenDetails\n\t}\n}\n","import { Context } from \"@core/context-runtime/context\"\nimport { ContextItem } from \"@core/context-runtime/context-item\"\nimport { FunctionCall } from \"@core/context-runtime/output/function-call\"\nimport { ModelMessage } from \"@core/context-runtime/output/model-message\"\nimport { Reasoning } from \"@core/context-runtime/output/reasoning\"\nimport { InferenceRequest } from \"@core/generative-model/inference-request\"\nimport { InferenceResponse } from \"@core/generative-model/inference-response\"\nimport { ModelRuntime } from \"@core/generative-model/runtime/model-runtime\"\nimport { InputTokenDetails, OutputTokenDetails, TokenUsage } from \"@core/generative-model/token-usage\"\nimport OpenAI from \"openai\"\n\nexport class OpenAIResponses implements ModelRuntime {\n\tprivate readonly client: OpenAI\n\tconstructor() {\n\t\tthis.client = new OpenAI()\n\t}\n\n\tasync infer(inferenceRequest: InferenceRequest): Promise<InferenceResponse> {\n\t\tconst input = this.mapContextToRequest(inferenceRequest.context)\n\n\t\tconst specification = inferenceRequest.model.specification\n\n\t\tlet request: any = {\n\t\t\tmodel: specification.name,\n\t\t\tinput: input,\n\t\t}\n\n\t\tif (specification.supportFunctionCalling && inferenceRequest.model.getTools().length > 0) {\n\t\t\trequest.tools = inferenceRequest.model.getTools().map((tool) => {\n\t\t\t\treturn {\n\t\t\t\t\ttype: tool.type,\n\t\t\t\t\tname: tool.name,\n\t\t\t\t\tdescription: tool.description,\n\t\t\t\t\tparameters: tool.parameters,\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tif (specification.supportReasoningEffort) {\n\t\t\trequest.reasoning = {\n\t\t\t\teffort: inferenceRequest.model.getReasoningEffort(),\n\t\t\t}\n\t\t}\n\n\t\tconst response = await this.client.responses.create(request)\n\n\t\tconst contextItems = this.extractContextItems(response)\n\t\tconst tokenUsage = this.extractTokenUsage(response)\n\t\treturn new InferenceResponse(contextItems, tokenUsage)\n\t}\n\n\textractTokenUsage(response: OpenAI.Responses.Response): TokenUsage | undefined {\n\t\tif (!response.usage) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn new TokenUsage(\n\t\t\tresponse.usage.input_tokens,\n\t\t\tresponse.usage.output_tokens,\n\t\t\tresponse.usage.total_tokens,\n\t\t\tnew InputTokenDetails(response.usage.input_tokens_details.cached_tokens),\n\t\t\tnew OutputTokenDetails(response.usage.output_tokens_details.reasoning_tokens),\n\t\t)\n\t}\n\n\tmapContextToRequest(context: Context): any[] {\n\t\treturn context.getItems().map((item) => item.toJSON())\n\t}\n\n\textractContextItems(response: any): ContextItem[] {\n\t\treturn response.output.map((item: any) => {\n\t\t\tif (item.type === \"message\" && item.status === \"completed\") {\n\t\t\t\treturn ModelMessage.rehydrate(item.content[0] as { text: string })\n\t\t\t}\n\t\t\tif (item.type === \"function_call\" && item.status === \"completed\") {\n\t\t\t\treturn FunctionCall.rehydrate(item)\n\t\t\t}\n\t\t\tif (item.type === \"reasoning\") {\n\t\t\t\treturn Reasoning.rehydrate(item)\n\t\t\t}\n\t\t})\n\t}\n}\n","import { Context } from \"@core/context-runtime/context\"\nimport { GenerativeModel } from \"./generative-model\"\nimport { ReasoningEffort } from \"./capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"./capabilities/tool-calling\"\n\nexport class InferenceRequest {\n\treadonly model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability\n\treadonly context: Context\n\n\tconstructor(model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability, context: Context) {\n\t\tthis.model = model\n\t\tthis.context = context\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\n\nexport type OpenAIReasoningEffortType = \"xhigh\" | \"high\" | \"medium\" | \"low\" | \"none\"\n\nexport class OpenAIReasoningEffort implements ReasoningEffort<OpenAIReasoningEffortType> {\n\treasoningEffort: OpenAIReasoningEffortType\n\n\tconstructor(reasoningEffort: OpenAIReasoningEffortType) {\n\t\tthis.reasoningEffort = reasoningEffort\n\t}\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.reasoningEffort = effort\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\tif (!this.reasoningEffort) {\n\t\t\tthrow new Error(\"Reasoning effort not supported\")\n\t\t}\n\t\treturn this.reasoningEffort\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@core/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@core/generative-model/generative-model\"\nimport { Tool } from \"@core/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@openai/reasoning-effort\"\n\nexport class Gpt54Nano implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {\n\treadonly specification = {\n\t\tname: \"gpt-5.4-nano\",\n\t\tsupportReasoningEffort: true,\n\t\tdefaultReasoningEffort: \"none\" as OpenAIReasoningEffortType,\n\t\tsupportStreaming: true,\n\t\tcontextWindowSize: 400_000,\n\t\tmaxOutputTokens: 128_000,\n\t\tsupportFunctionCalling: true,\n\t}\n\n\tprivate tools: Tool[] = []\n\n\tprivate readonly effort: OpenAIReasoningEffort = new OpenAIReasoningEffort(\n\t\tthis.specification.defaultReasoningEffort,\n\t)\n\n\tsetTools(tools: Tool[]): void {\n\t\tthis.tools = tools\n\t}\n\n\tgetTools(): Tool[] {\n\t\treturn this.tools\n\t}\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.effort.setReasoningEffort(effort)\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\treturn this.effort.getReasoningEffort()\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@core/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@core/generative-model/generative-model\"\nimport { Tool } from \"@core/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@openai/reasoning-effort\"\n\nexport class Gpt54 implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {\n\treadonly specification = {\n\t\tname: \"gpt-5.4\",\n\t\tsupportReasoningEffort: true,\n\t\tdefaultReasoningEffort: \"none\" as OpenAIReasoningEffortType,\n\t\tsupportStreaming: true,\n\t\tcontextWindowSize: 1_050_000,\n\t\tmaxOutputTokens: 128_000,\n\t\tsupportFunctionCalling: true,\n\t}\n\n\tprivate tools: Tool[] = []\n\n\tsetTools(tools: Tool[]): void {\n\t\tthis.tools = tools\n\t}\n\n\tgetTools(): Tool[] {\n\t\treturn this.tools\n\t}\n\n\tprivate readonly effort: OpenAIReasoningEffort = new OpenAIReasoningEffort(\n\t\tthis.specification.defaultReasoningEffort,\n\t)\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.effort.setReasoningEffort(effort)\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\treturn this.effort.getReasoningEffort()\n\t}\n}\n","import { ReasoningEffort } from \"@core/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@core/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@core/generative-model/generative-model\"\nimport { Tool } from \"@core/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@openai/reasoning-effort\"\n\nexport class Gpt54Mini implements GenerativeModel, ReasoningEffort<OpenAIReasoningEffortType>, ToolCallingCapability {\n\treadonly specification = {\n\t\tname: \"gpt-5.4-mini\",\n\t\tsupportReasoningEffort: true,\n\t\tdefaultReasoningEffort: \"none\" as OpenAIReasoningEffortType,\n\t\tsupportStreaming: true,\n\t\tcontextWindowSize: 400_000,\n\t\tmaxOutputTokens: 128_000,\n\t\tsupportFunctionCalling: true,\n\t}\n\n\tprivate tools: Tool[] = []\n\n\tprivate readonly effort: OpenAIReasoningEffort = new OpenAIReasoningEffort(\n\t\tthis.specification.defaultReasoningEffort,\n\t)\n\n\tsetReasoningEffort(effort: OpenAIReasoningEffortType): void {\n\t\tthis.effort.setReasoningEffort(effort)\n\t}\n\tgetReasoningEffort(): OpenAIReasoningEffortType {\n\t\treturn this.effort.getReasoningEffort()\n\t}\n\n\tsetTools(tools: Tool[]): void {\n\t\tthis.tools = tools\n\t}\n\n\tgetTools(): Tool[] {\n\t\treturn this.tools\n\t}\n}\n","export interface Condition<T> {\n\tisSatisfiedBy(candidate: T): boolean\n\tand(other: Condition<T>): Condition<T>\n\tor(other: Condition<T>): Condition<T>\n\tnot(): Condition<T>\n}\n\nexport abstract class BaseCondition<T> implements Condition<T> {\n\tabstract isSatisfiedBy(candidate: T): boolean\n\n\tand(other: Condition<T>): Condition<T> {\n\t\treturn new AndCondition(this, other)\n\t}\n\n\tor(other: Condition<T>): Condition<T> {\n\t\treturn new OrCondition(this, other)\n\t}\n\n\tnot(): Condition<T> {\n\t\treturn new NotCondition(this)\n\t}\n}\n\nexport class AndCondition<T> extends BaseCondition<T> {\n\tconstructor(\n\t\tprivate readonly left: Condition<T>,\n\t\tprivate readonly right: Condition<T>,\n\t) {\n\t\tsuper()\n\t}\n\n\tisSatisfiedBy(candidate: T): boolean {\n\t\treturn this.left.isSatisfiedBy(candidate) && this.right.isSatisfiedBy(candidate)\n\t}\n}\n\nexport class NotCondition<T> extends BaseCondition<T> {\n\tconstructor(private readonly condition: Condition<T>) {\n\t\tsuper()\n\t}\n\n\tisSatisfiedBy(candidate: T): boolean {\n\t\treturn !this.condition.isSatisfiedBy(candidate)\n\t}\n}\n\nexport class OrCondition<T> extends BaseCondition<T> {\n\tconstructor(\n\t\tprivate readonly left: Condition<T>,\n\t\tprivate readonly right: Condition<T>,\n\t) {\n\t\tsuper()\n\t}\n\n\tisSatisfiedBy(candidate: T): boolean {\n\t\treturn this.left.isSatisfiedBy(candidate) || this.right.isSatisfiedBy(candidate)\n\t}\n}\n","import { Condition } from \"@core/context-engine/condition/condition\"\n\nexport interface Action<T> {\n\tapply(candidate: T): T\n}\n\nexport interface Rule<T> {\n\tcondition: Condition<T>\n\taction: Action<T>\n\tapply(candidate: T): T\n}\n\nexport class If<T> implements Rule<T> {\n\tcondition: Condition<T>\n\taction: Action<T>\n\n\tconstructor({ condition, action }: { condition: Condition<T>; action: Action<T> }) {\n\t\tthis.condition = condition\n\t\tthis.action = action\n\t}\n\n\tapply(candidate: T): T {\n\t\tif (this.condition.isSatisfiedBy(candidate)) {\n\t\t\treturn this.action.apply(candidate)\n\t\t}\n\t\treturn candidate\n\t}\n}\n\nexport class Loop<T> {\n\tprivate condition: Condition<T>\n\tprivate action: Action<T>\n\n\tconstructor({ condition, action }: { condition: Condition<T>; action: Action<T> }) {\n\t\tthis.condition = condition\n\t\tthis.action = action\n\t}\n\n\tapply(candidate: T): T {\n\t\twhile (this.condition.isSatisfiedBy(candidate)) {\n\t\t\tcandidate = this.action.apply(candidate)\n\t\t}\n\t\treturn candidate\n\t}\n}","import { Context } from \"@core/context-runtime/context\"\nimport { ContextRepository } from \"@core/context-runtime/context-repository\"\n\nexport class InMemoryContextRepository implements ContextRepository {\n\tprivate readonly store = new Map<string, Context>()\n\tprivate readonly projectIndex = new Map<string, Set<string>>()\n\n\tasync save(context: Context): Promise<void> {\n\t\tconst existing = this.store.get(context.id)\n\t\tif (existing && existing.projectId !== context.projectId) {\n\t\t\tconst prevSet = this.projectIndex.get(existing.projectId)\n\t\t\tprevSet?.delete(existing.id)\n\t\t\tif (prevSet && prevSet.size === 0) this.projectIndex.delete(existing.projectId)\n\t\t}\n\n\t\tthis.store.set(context.id, this.clone(context))\n\n\t\tlet set = this.projectIndex.get(context.projectId)\n\t\tif (!set) {\n\t\t\tset = new Set<string>()\n\t\t\tthis.projectIndex.set(context.projectId, set)\n\t\t}\n\t\tset.add(context.id)\n\t}\n\n\tasync get(id: string): Promise<Context> {\n\t\tconst context = this.store.get(id)\n\t\tif (!context) {\n\t\t\tthrow new Error(`Context not found: ${id}`)\n\t\t}\n\t\treturn this.clone(context)\n\t}\n\n\tasync getByProjectId(projectId: string): Promise<Context[]> {\n\t\tconst ids = this.projectIndex.get(projectId)\n\t\tif (!ids || ids.size === 0) return []\n\t\treturn [...ids]\n\t\t\t.map((id) => this.store.get(id))\n\t\t\t.filter((c): c is Context => Boolean(c))\n\t\t\t.map((c) => this.clone(c))\n\t}\n\n\tprivate clone(context: Context): Context {\n\t\treturn Context.rehydrate({\n\t\t\tid: context.id,\n\t\t\tprojectId: context.projectId,\n\t\t\titems: [...context.getItems()],\n\t\t})\n\t}\n}\n"],"mappings":";AAEO,IAAM,UAAN,MAAM,SAAQ;AAAA,EAKpB,YAAY,IAAY,WAAmB,OAAsB;AAChE,SAAK,YAAY;AACjB,SAAK,KAAK;AACV,SAAK,QAAQ;AAAA,EACd;AAAA,EAEA,QAAQ,MAA4B;AACnC,SAAK,MAAM,KAAK,IAAI;AACpB,WAAO;AAAA,EACR;AAAA,EAEA,iBAAiB,OAA+B;AAC/C,eAAW,QAAQ,OAAO;AACzB,YAAM,WAAW,KAAK,QAAQ;AAC9B,UAAI,aAAa,mBAAmB,aAAa,aAAa,aAAa,aAAa;AAC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