@mozaik-ai/core 2.13.7 → 3.0.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/README.md +1 -1
- package/dist/index.d.mts +8 -13
- package/dist/index.d.ts +8 -13
- package/dist/index.js +28 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Mozaik
|
|
2
2
|
|
|
3
|
-
**Mozaik** is a TypeScript
|
|
3
|
+
**Mozaik** is a TypeScript framework for building controllable multi-step AI agents.
|
|
4
4
|
|
|
5
5
|
Instead of focusing on agents themselves, Mozaik provides a structured way to **model, manipulate, persist, and restore the context** that drives language model behavior. It implements a clean object model aligned with the **OpenResponses specification**, enabling developers to work with LLM inputs and outputs as composable, typed entities.
|
|
6
6
|
|
package/dist/index.d.mts
CHANGED
|
@@ -23,11 +23,11 @@ declare class Context {
|
|
|
23
23
|
toJSON(): any;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
declare abstract class
|
|
26
|
+
declare abstract class ItemContent {
|
|
27
27
|
abstract readonly type: string;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
declare class InputText extends
|
|
30
|
+
declare class InputText extends ItemContent {
|
|
31
31
|
readonly text: string;
|
|
32
32
|
readonly type = "input_text";
|
|
33
33
|
private constructor();
|
|
@@ -62,7 +62,7 @@ declare class DeveloperMessage extends ContextItem {
|
|
|
62
62
|
}): DeveloperMessage;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
declare class OutputText extends
|
|
65
|
+
declare class OutputText extends ItemContent {
|
|
66
66
|
readonly text: string;
|
|
67
67
|
readonly type = "output_text";
|
|
68
68
|
private constructor();
|
|
@@ -97,7 +97,7 @@ declare class FunctionCall extends ContextItem {
|
|
|
97
97
|
toJSON(): any;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
declare class SummaryText extends
|
|
100
|
+
declare class SummaryText extends ItemContent {
|
|
101
101
|
readonly text: string;
|
|
102
102
|
readonly type = "summary_text";
|
|
103
103
|
private constructor();
|
|
@@ -137,12 +137,12 @@ interface GenerativeModel {
|
|
|
137
137
|
declare class FunctionCallOutput extends ContextItem {
|
|
138
138
|
readonly type = "function_call_output";
|
|
139
139
|
readonly callId: string;
|
|
140
|
-
readonly output: InputText
|
|
140
|
+
readonly output: InputText;
|
|
141
141
|
private constructor();
|
|
142
|
-
static create(callId: string, output: string
|
|
142
|
+
static create(callId: string, output: string): FunctionCallOutput;
|
|
143
143
|
static rehydrate(data: {
|
|
144
144
|
callId: string;
|
|
145
|
-
output: InputText
|
|
145
|
+
output: InputText;
|
|
146
146
|
}): FunctionCallOutput;
|
|
147
147
|
toJSON(): any;
|
|
148
148
|
}
|
|
@@ -290,11 +290,6 @@ interface Action<T> {
|
|
|
290
290
|
interface AsyncAction<T> {
|
|
291
291
|
apply(candidate: T): Promise<T>;
|
|
292
292
|
}
|
|
293
|
-
interface Rule<T> {
|
|
294
|
-
condition: Condition<T>;
|
|
295
|
-
action: AsyncAction<T>;
|
|
296
|
-
apply(candidate: T): T;
|
|
297
|
-
}
|
|
298
293
|
interface AsyncRule<T> {
|
|
299
294
|
condition: Condition<T>;
|
|
300
295
|
action: AsyncAction<T>;
|
|
@@ -328,4 +323,4 @@ declare class InMemoryContextRepository implements ContextRepository {
|
|
|
328
323
|
private clone;
|
|
329
324
|
}
|
|
330
325
|
|
|
331
|
-
export { type Action, type AsyncAction, type AsyncRule, BaseCondition, type Condition, Context, ContextItem, type ContextRepository, DeveloperMessage, FunctionCall, FunctionCallOutput, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, If, InMemoryContextRepository, InferenceRequest, InferenceResponse, InputTokenDetails, Loop, ModelMessage, OpenAIResponses, OutputTokenDetails, Reasoning,
|
|
326
|
+
export { type Action, type AsyncAction, type AsyncRule, BaseCondition, type Condition, Context, ContextItem, type ContextRepository, DeveloperMessage, FunctionCall, FunctionCallOutput, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, If, InMemoryContextRepository, InferenceRequest, InferenceResponse, InputTokenDetails, Loop, ModelMessage, OpenAIResponses, OutputTokenDetails, Reasoning, TokenUsage, type Tool, UserMessage };
|
package/dist/index.d.ts
CHANGED
|
@@ -23,11 +23,11 @@ declare class Context {
|
|
|
23
23
|
toJSON(): any;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
declare abstract class
|
|
26
|
+
declare abstract class ItemContent {
|
|
27
27
|
abstract readonly type: string;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
declare class InputText extends
|
|
30
|
+
declare class InputText extends ItemContent {
|
|
31
31
|
readonly text: string;
|
|
32
32
|
readonly type = "input_text";
|
|
33
33
|
private constructor();
|
|
@@ -62,7 +62,7 @@ declare class DeveloperMessage extends ContextItem {
|
|
|
62
62
|
}): DeveloperMessage;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
declare class OutputText extends
|
|
65
|
+
declare class OutputText extends ItemContent {
|
|
66
66
|
readonly text: string;
|
|
67
67
|
readonly type = "output_text";
|
|
68
68
|
private constructor();
|
|
@@ -97,7 +97,7 @@ declare class FunctionCall extends ContextItem {
|
|
|
97
97
|
toJSON(): any;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
declare class SummaryText extends
|
|
100
|
+
declare class SummaryText extends ItemContent {
|
|
101
101
|
readonly text: string;
|
|
102
102
|
readonly type = "summary_text";
|
|
103
103
|
private constructor();
|
|
@@ -137,12 +137,12 @@ interface GenerativeModel {
|
|
|
137
137
|
declare class FunctionCallOutput extends ContextItem {
|
|
138
138
|
readonly type = "function_call_output";
|
|
139
139
|
readonly callId: string;
|
|
140
|
-
readonly output: InputText
|
|
140
|
+
readonly output: InputText;
|
|
141
141
|
private constructor();
|
|
142
|
-
static create(callId: string, output: string
|
|
142
|
+
static create(callId: string, output: string): FunctionCallOutput;
|
|
143
143
|
static rehydrate(data: {
|
|
144
144
|
callId: string;
|
|
145
|
-
output: InputText
|
|
145
|
+
output: InputText;
|
|
146
146
|
}): FunctionCallOutput;
|
|
147
147
|
toJSON(): any;
|
|
148
148
|
}
|
|
@@ -290,11 +290,6 @@ interface Action<T> {
|
|
|
290
290
|
interface AsyncAction<T> {
|
|
291
291
|
apply(candidate: T): Promise<T>;
|
|
292
292
|
}
|
|
293
|
-
interface Rule<T> {
|
|
294
|
-
condition: Condition<T>;
|
|
295
|
-
action: AsyncAction<T>;
|
|
296
|
-
apply(candidate: T): T;
|
|
297
|
-
}
|
|
298
293
|
interface AsyncRule<T> {
|
|
299
294
|
condition: Condition<T>;
|
|
300
295
|
action: AsyncAction<T>;
|
|
@@ -328,4 +323,4 @@ declare class InMemoryContextRepository implements ContextRepository {
|
|
|
328
323
|
private clone;
|
|
329
324
|
}
|
|
330
325
|
|
|
331
|
-
export { type Action, type AsyncAction, type AsyncRule, BaseCondition, type Condition, Context, ContextItem, type ContextRepository, DeveloperMessage, FunctionCall, FunctionCallOutput, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, If, InMemoryContextRepository, InferenceRequest, InferenceResponse, InputTokenDetails, Loop, ModelMessage, OpenAIResponses, OutputTokenDetails, Reasoning,
|
|
326
|
+
export { type Action, type AsyncAction, type AsyncRule, BaseCondition, type Condition, Context, ContextItem, type ContextRepository, DeveloperMessage, FunctionCall, FunctionCallOutput, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, If, InMemoryContextRepository, InferenceRequest, InferenceResponse, InputTokenDetails, Loop, ModelMessage, OpenAIResponses, OutputTokenDetails, Reasoning, TokenUsage, type Tool, UserMessage };
|
package/dist/index.js
CHANGED
|
@@ -54,7 +54,7 @@ __export(index_exports, {
|
|
|
54
54
|
});
|
|
55
55
|
module.exports = __toCommonJS(index_exports);
|
|
56
56
|
|
|
57
|
-
// src/
|
|
57
|
+
// src/domain/model-context/context.ts
|
|
58
58
|
var Context = class _Context {
|
|
59
59
|
constructor(id, projectId, items) {
|
|
60
60
|
this.projectId = projectId;
|
|
@@ -90,19 +90,19 @@ var Context = class _Context {
|
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
// src/
|
|
93
|
+
// src/domain/model-context/context-item/context-item.ts
|
|
94
94
|
var ContextItem = class {
|
|
95
95
|
getType() {
|
|
96
96
|
return this.type;
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
// src/
|
|
101
|
-
var
|
|
100
|
+
// src/domain/model-context/context-item/item-content/item-content.ts
|
|
101
|
+
var ItemContent = class {
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
// src/
|
|
105
|
-
var InputText = class _InputText extends
|
|
104
|
+
// src/domain/model-context/context-item/item-content/input-text.ts
|
|
105
|
+
var InputText = class _InputText extends ItemContent {
|
|
106
106
|
constructor(text) {
|
|
107
107
|
super();
|
|
108
108
|
this.text = text;
|
|
@@ -124,7 +124,7 @@ var InputText = class _InputText extends Content {
|
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
-
// src/
|
|
127
|
+
// src/domain/model-context/context-item/client-item/user-message.ts
|
|
128
128
|
var UserMessage = class _UserMessage extends ContextItem {
|
|
129
129
|
constructor(content) {
|
|
130
130
|
super();
|
|
@@ -149,7 +149,7 @@ var UserMessage = class _UserMessage extends ContextItem {
|
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
// src/
|
|
152
|
+
// src/domain/model-context/context-item/client-item/developer-message.ts
|
|
153
153
|
var DeveloperMessage = class _DeveloperMessage extends ContextItem {
|
|
154
154
|
constructor(content) {
|
|
155
155
|
super();
|
|
@@ -174,8 +174,8 @@ var DeveloperMessage = class _DeveloperMessage extends ContextItem {
|
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
176
|
|
|
177
|
-
// src/
|
|
178
|
-
var OutputText = class _OutputText extends
|
|
177
|
+
// src/domain/model-context/context-item/item-content/output-text.ts
|
|
178
|
+
var OutputText = class _OutputText extends ItemContent {
|
|
179
179
|
constructor(text) {
|
|
180
180
|
super();
|
|
181
181
|
this.text = text;
|
|
@@ -194,7 +194,7 @@ var OutputText = class _OutputText extends Content {
|
|
|
194
194
|
}
|
|
195
195
|
};
|
|
196
196
|
|
|
197
|
-
// src/
|
|
197
|
+
// src/domain/model-context/context-item/model-item/model-message.ts
|
|
198
198
|
var ModelMessage = class _ModelMessage extends ContextItem {
|
|
199
199
|
constructor(content) {
|
|
200
200
|
super();
|
|
@@ -215,7 +215,7 @@ var ModelMessage = class _ModelMessage extends ContextItem {
|
|
|
215
215
|
}
|
|
216
216
|
};
|
|
217
217
|
|
|
218
|
-
// src/
|
|
218
|
+
// src/domain/model-context/context-item/model-item/function-call.ts
|
|
219
219
|
var FunctionCall = class _FunctionCall extends ContextItem {
|
|
220
220
|
constructor(callId, name, args) {
|
|
221
221
|
super();
|
|
@@ -237,7 +237,7 @@ var FunctionCall = class _FunctionCall extends ContextItem {
|
|
|
237
237
|
}
|
|
238
238
|
};
|
|
239
239
|
|
|
240
|
-
// src/
|
|
240
|
+
// src/domain/model-context/context-item/model-item/reasoning.ts
|
|
241
241
|
var Reasoning = class _Reasoning extends ContextItem {
|
|
242
242
|
constructor(content, encryptedContent, summary = []) {
|
|
243
243
|
super();
|
|
@@ -260,7 +260,7 @@ var Reasoning = class _Reasoning extends ContextItem {
|
|
|
260
260
|
}
|
|
261
261
|
};
|
|
262
262
|
|
|
263
|
-
// src/
|
|
263
|
+
// src/domain/model-context/context-item/client-item/function-call-output.ts
|
|
264
264
|
var FunctionCallOutput = class _FunctionCallOutput extends ContextItem {
|
|
265
265
|
constructor(callId, output) {
|
|
266
266
|
super();
|
|
@@ -269,8 +269,8 @@ var FunctionCallOutput = class _FunctionCallOutput extends ContextItem {
|
|
|
269
269
|
this.output = output;
|
|
270
270
|
}
|
|
271
271
|
static create(callId, output) {
|
|
272
|
-
const
|
|
273
|
-
return new _FunctionCallOutput(callId,
|
|
272
|
+
const outputText = InputText.create(output);
|
|
273
|
+
return new _FunctionCallOutput(callId, outputText);
|
|
274
274
|
}
|
|
275
275
|
static rehydrate(data) {
|
|
276
276
|
return new _FunctionCallOutput(data.callId, data.output);
|
|
@@ -279,12 +279,12 @@ var FunctionCallOutput = class _FunctionCallOutput extends ContextItem {
|
|
|
279
279
|
return {
|
|
280
280
|
type: this.type,
|
|
281
281
|
call_id: this.callId,
|
|
282
|
-
output: this.output.
|
|
282
|
+
output: this.output.toJSON()
|
|
283
283
|
};
|
|
284
284
|
}
|
|
285
285
|
};
|
|
286
286
|
|
|
287
|
-
// src/
|
|
287
|
+
// src/domain/generative-model/inference-response.ts
|
|
288
288
|
var InferenceResponse = class {
|
|
289
289
|
constructor(contextItems, tokenUsage) {
|
|
290
290
|
this.contextItems = contextItems;
|
|
@@ -292,7 +292,7 @@ var InferenceResponse = class {
|
|
|
292
292
|
}
|
|
293
293
|
};
|
|
294
294
|
|
|
295
|
-
// src/
|
|
295
|
+
// src/domain/generative-model/token-usage.ts
|
|
296
296
|
var InputTokenDetails = class {
|
|
297
297
|
constructor(cached_tokens) {
|
|
298
298
|
this.cached_tokens = cached_tokens;
|
|
@@ -313,7 +313,7 @@ var TokenUsage = class {
|
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
315
|
|
|
316
|
-
// src/providers/openai/runtime/openai-responses.ts
|
|
316
|
+
// src/infrastructure/providers/openai/runtime/openai-responses.ts
|
|
317
317
|
var import_openai = __toESM(require("openai"));
|
|
318
318
|
var OpenAIResponses = class {
|
|
319
319
|
constructor() {
|
|
@@ -380,7 +380,7 @@ var OpenAIResponses = class {
|
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
382
|
|
|
383
|
-
// src/
|
|
383
|
+
// src/domain/generative-model/inference-request.ts
|
|
384
384
|
var InferenceRequest = class {
|
|
385
385
|
constructor(model, context) {
|
|
386
386
|
this.model = model;
|
|
@@ -388,7 +388,7 @@ var InferenceRequest = class {
|
|
|
388
388
|
}
|
|
389
389
|
};
|
|
390
390
|
|
|
391
|
-
// src/providers/openai/reasoning-effort.ts
|
|
391
|
+
// src/infrastructure/providers/openai/reasoning-effort.ts
|
|
392
392
|
var OpenAIReasoningEffort = class {
|
|
393
393
|
constructor(reasoningEffort) {
|
|
394
394
|
this.reasoningEffort = reasoningEffort;
|
|
@@ -404,7 +404,7 @@ var OpenAIReasoningEffort = class {
|
|
|
404
404
|
}
|
|
405
405
|
};
|
|
406
406
|
|
|
407
|
-
// src/providers/openai/models/gpt-5-4-nano.ts
|
|
407
|
+
// src/infrastructure/providers/openai/models/gpt-5-4-nano.ts
|
|
408
408
|
var Gpt54Nano = class {
|
|
409
409
|
constructor() {
|
|
410
410
|
this.specification = {
|
|
@@ -435,7 +435,7 @@ var Gpt54Nano = class {
|
|
|
435
435
|
}
|
|
436
436
|
};
|
|
437
437
|
|
|
438
|
-
// src/providers/openai/models/gpt-5-4.ts
|
|
438
|
+
// src/infrastructure/providers/openai/models/gpt-5-4.ts
|
|
439
439
|
var Gpt54 = class {
|
|
440
440
|
constructor() {
|
|
441
441
|
this.specification = {
|
|
@@ -466,7 +466,7 @@ var Gpt54 = class {
|
|
|
466
466
|
}
|
|
467
467
|
};
|
|
468
468
|
|
|
469
|
-
// src/providers/openai/models/gpt-5-4-mini.ts
|
|
469
|
+
// src/infrastructure/providers/openai/models/gpt-5-4-mini.ts
|
|
470
470
|
var Gpt54Mini = class {
|
|
471
471
|
constructor() {
|
|
472
472
|
this.specification = {
|
|
@@ -497,7 +497,7 @@ var Gpt54Mini = class {
|
|
|
497
497
|
}
|
|
498
498
|
};
|
|
499
499
|
|
|
500
|
-
// src/
|
|
500
|
+
// src/domain/agent-loop/rules/condition/condition.ts
|
|
501
501
|
var BaseCondition = class {
|
|
502
502
|
and(other) {
|
|
503
503
|
return new AndCondition(this, other);
|
|
@@ -539,7 +539,7 @@ var OrCondition = class extends BaseCondition {
|
|
|
539
539
|
}
|
|
540
540
|
};
|
|
541
541
|
|
|
542
|
-
// src/
|
|
542
|
+
// src/domain/agent-loop/rules/rule/rule.ts
|
|
543
543
|
var If = class {
|
|
544
544
|
constructor({ condition, action }) {
|
|
545
545
|
this.condition = condition;
|
|
@@ -565,7 +565,7 @@ var Loop = class {
|
|
|
565
565
|
}
|
|
566
566
|
};
|
|
567
567
|
|
|
568
|
-
// src/
|
|
568
|
+
// src/infrastructure/repository/in-memory-context-repository.ts
|
|
569
569
|
var InMemoryContextRepository = class {
|
|
570
570
|
constructor() {
|
|
571
571
|
this.store = /* @__PURE__ */ new Map();
|
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, If, Loop, AsyncAction, AsyncRule } 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\tCondition,\n\tBaseCondition,\n\tAction,\n\tAsyncAction,\n\tRule,\n\tAsyncRule,\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\tcall_id: 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: string[]): FunctionCallOutput {\n\t\tconst outputTexts = output.map((o) => InputText.create(o))\n\t\treturn new FunctionCallOutput(callId, outputTexts)\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\tcall_id: 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.role === \"assistant\") {\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\") {\n\t\t\t\treturn FunctionCall.rehydrate({\n\t\t\t\t\tcallId: item.call_id,\n\t\t\t\t\tname: item.name,\n\t\t\t\t\targs: item.arguments,\n\t\t\t\t})\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 AsyncAction<T> {\n\tapply(candidate: T): Promise<T>\n}\n\nexport interface Rule<T> {\n\tcondition: Condition<T>\n\taction: AsyncAction<T>\n\tapply(candidate: T): T\n}\n\nexport interface AsyncRule<T> {\n\tcondition: Condition<T>\n\taction: AsyncAction<T>\n\tapply(candidate: T): Promise<T>\n}\n\nexport class If<T> implements AsyncRule<T> {\n\tcondition: Condition<T>\n\taction: AsyncAction<T>\n\n\tconstructor({ condition, action }: { condition: Condition<T>; action: AsyncAction<T> }) {\n\t\tthis.condition = condition\n\t\tthis.action = action\n\t}\n\n\tasync apply(candidate: T): Promise<T> {\n\t\tif (this.condition.isSatisfiedBy(candidate)) {\n\t\t\treturn await this.action.apply(candidate)\n\t\t}\n\t\treturn candidate\n\t}\n}\n\nexport class Loop<T> implements AsyncRule<T> {\n\tcondition: Condition<T>\n\taction: AsyncAction<T>\n\n\tconstructor({ condition, action }: { condition: Condition<T>; action: AsyncAction<T> }) {\n\t\tthis.condition = condition\n\t\tthis.action = action\n\t}\n\n\tasync apply(candidate: T): Promise<T> {\n\t\twhile (this.condition.isSatisfiedBy(candidate)) {\n\t\t\tcandidate = await 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;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,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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/domain/model-context/context.ts","../src/domain/model-context/context-item/context-item.ts","../src/domain/model-context/context-item/item-content/item-content.ts","../src/domain/model-context/context-item/item-content/input-text.ts","../src/domain/model-context/context-item/client-item/user-message.ts","../src/domain/model-context/context-item/client-item/developer-message.ts","../src/domain/model-context/context-item/item-content/output-text.ts","../src/domain/model-context/context-item/model-item/model-message.ts","../src/domain/model-context/context-item/model-item/function-call.ts","../src/domain/model-context/context-item/model-item/reasoning.ts","../src/domain/model-context/context-item/client-item/function-call-output.ts","../src/domain/generative-model/inference-response.ts","../src/domain/generative-model/token-usage.ts","../src/infrastructure/providers/openai/runtime/openai-responses.ts","../src/domain/generative-model/inference-request.ts","../src/infrastructure/providers/openai/reasoning-effort.ts","../src/infrastructure/providers/openai/models/gpt-5-4-nano.ts","../src/infrastructure/providers/openai/models/gpt-5-4.ts","../src/infrastructure/providers/openai/models/gpt-5-4-mini.ts","../src/domain/agent-loop/rules/condition/condition.ts","../src/domain/agent-loop/rules/rule/rule.ts","../src/infrastructure/repository/in-memory-context-repository.ts"],"sourcesContent":["import { Context } from \"@domain/model-context/context\"\nimport { ContextItem } from \"@domain/model-context/context-item/context-item\"\nimport { UserMessage } from \"@domain/model-context/context-item/client-item/user-message\"\nimport { DeveloperMessage } from \"@domain/model-context/context-item/client-item/developer-message\"\nimport { ModelMessage } from \"@domain/model-context/context-item/model-item/model-message\"\nimport { FunctionCall } from \"@domain/model-context/context-item/model-item/function-call\"\nimport { Reasoning } from \"@domain/model-context/context-item/model-item/reasoning\"\nimport { GenerativeModel } from \"@domain/generative-model/generative-model\"\nimport { FunctionCallOutput } from \"@domain/model-context/context-item/client-item/function-call-output\"\nimport { ContextRepository } from \"@domain/model-context/context-repository\"\nimport { OpenAIResponses } from \"@infra/providers/openai/runtime/openai-responses\"\nimport { InferenceRequest } from \"@domain/generative-model/inference-request\"\nimport { Gpt54Nano } from \"@infra/providers/openai/models/gpt-5-4-nano\"\nimport { Gpt54 } from \"@infra/providers/openai/models/gpt-5-4\"\nimport { Gpt54Mini } from \"@infra/providers/openai/models/gpt-5-4-mini\"\nimport { InferenceResponse } from \"@domain/generative-model/inference-response\"\nimport { InputTokenDetails, OutputTokenDetails, TokenUsage } from \"@domain/generative-model/token-usage\"\nimport { Tool } from \"@domain/generative-model/tool\"\nimport { BaseCondition, Condition } from \"@domain/agent-loop/rules/condition/condition\"\nimport { Action, If, Loop, AsyncAction, AsyncRule } from \"@domain/agent-loop/rules/rule/rule\"\nimport { InMemoryContextRepository } from \"@infra/repository/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\tCondition,\n\tBaseCondition,\n\tAction,\n\tAsyncAction,\n\tAsyncRule,\n\tIf,\n\tLoop,\n}\n","import { ContextItem } from \"@domain/model-context/context-item/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 ItemContent {\n\tabstract readonly type: string\n}\n","import { ItemContent } from \"@domain/model-context/context-item/item-content/item-content\"\n\nexport class InputText extends ItemContent {\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 \"@domain/model-context/context-item/context-item\"\nimport { InputText } from \"@domain/model-context/context-item/item-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 \"@domain/model-context/context-item/item-content/input-text\"\nimport { ContextItem } from \"@domain/model-context/context-item/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 { ItemContent } from \"@domain/model-context/context-item/item-content/item-content\"\n\nexport class OutputText extends ItemContent {\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 \"@domain/model-context/context-item/context-item\"\nimport { OutputText } from \"@domain/model-context/context-item/item-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 \"@domain/model-context/context-item/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\tcall_id: this.callId,\n\t\t\tname: this.name,\n\t\t\targuments: this.args,\n\t\t}\n\t}\n}\n","import { InputText } from \"@domain/model-context/context-item/item-content/input-text\"\nimport { SummaryText } from \"@domain/model-context/context-item/item-content/summary-text\"\nimport { ContextItem } from \"@domain/model-context/context-item/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 \"@domain/model-context/context-item/context-item\"\nimport { InputText } from \"@domain/model-context/context-item/item-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: string): FunctionCallOutput {\n\t\tconst outputText = InputText.create(output)\n\t\treturn new FunctionCallOutput(callId, outputText)\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\tcall_id: this.callId,\n\t\t\toutput: this.output.toJSON(),\n\t\t}\n\t}\n}\n","import { ContextItem } from \"@domain/model-context/context-item/context-item\"\nimport { TokenUsage } from \"@domain/generative-model/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 \"@domain/model-context/context\"\nimport { ContextItem } from \"@domain/model-context/context-item/context-item\"\nimport { FunctionCall } from \"@domain/model-context/context-item/model-item/function-call\"\nimport { ModelMessage } from \"@domain/model-context/context-item/model-item/model-message\"\nimport { Reasoning } from \"@domain/model-context/context-item/model-item/reasoning\"\nimport { InferenceRequest } from \"@domain/generative-model/inference-request\"\nimport { InferenceResponse } from \"@domain/generative-model/inference-response\"\nimport { ModelRuntime } from \"@domain/generative-model/runtime/model-runtime\"\nimport { InputTokenDetails, OutputTokenDetails, TokenUsage } from \"@domain/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.role === \"assistant\") {\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\") {\n\t\t\t\treturn FunctionCall.rehydrate({\n\t\t\t\t\tcallId: item.call_id,\n\t\t\t\t\tname: item.name,\n\t\t\t\t\targs: item.arguments,\n\t\t\t\t})\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 \"@domain/model-context/context\"\nimport { GenerativeModel } from \"@domain/generative-model/generative-model\"\nimport { ReasoningEffort } from \"@domain/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@domain/generative-model/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 \"@domain/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 \"@domain/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@domain/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@domain/generative-model/generative-model\"\nimport { Tool } from \"@domain/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@infra/providers/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 \"@domain/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@domain/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@domain/generative-model/generative-model\"\nimport { Tool } from \"@domain/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@infra/providers/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 \"@domain/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@domain/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@domain/generative-model/generative-model\"\nimport { Tool } from \"@domain/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@infra/providers/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 \"@domain/agent-loop/rules/condition/condition\"\n\nexport interface Action<T> {\n\tapply(candidate: T): T\n}\n\nexport interface AsyncAction<T> {\n\tapply(candidate: T): Promise<T>\n}\n\nexport interface AsyncRule<T> {\n\tcondition: Condition<T>\n\taction: AsyncAction<T>\n\tapply(candidate: T): Promise<T>\n}\n\nexport class If<T> implements AsyncRule<T> {\n\tcondition: Condition<T>\n\taction: AsyncAction<T>\n\n\tconstructor({ condition, action }: { condition: Condition<T>; action: AsyncAction<T> }) {\n\t\tthis.condition = condition\n\t\tthis.action = action\n\t}\n\n\tasync apply(candidate: T): Promise<T> {\n\t\tif (this.condition.isSatisfiedBy(candidate)) {\n\t\t\treturn await this.action.apply(candidate)\n\t\t}\n\t\treturn candidate\n\t}\n}\n\nexport class Loop<T> implements AsyncRule<T> {\n\tcondition: Condition<T>\n\taction: AsyncAction<T>\n\n\tconstructor({ condition, action }: { condition: Condition<T>; action: AsyncAction<T> }) {\n\t\tthis.condition = condition\n\t\tthis.action = action\n\t}\n\n\tasync apply(candidate: T): Promise<T> {\n\t\twhile (this.condition.isSatisfiedBy(candidate)) {\n\t\t\tcandidate = await this.action.apply(candidate)\n\t\t}\n\t\treturn candidate\n\t}\n}\n","import { Context } from \"@domain/model-context/context\"\nimport { ContextRepository } from \"@domain/model-context/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;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A,MACnB,OAAO,CAAC,GAAG,QAAQ,SAAS,CAAC;AAAA,IAC9B,CAAC;AAAA,EACF;AACD;","names":["OpenAI"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/domain/model-context/context.ts
|
|
2
2
|
var Context = class _Context {
|
|
3
3
|
constructor(id, projectId, items) {
|
|
4
4
|
this.projectId = projectId;
|
|
@@ -34,19 +34,19 @@ var Context = class _Context {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
// src/
|
|
37
|
+
// src/domain/model-context/context-item/context-item.ts
|
|
38
38
|
var ContextItem = class {
|
|
39
39
|
getType() {
|
|
40
40
|
return this.type;
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
// src/
|
|
45
|
-
var
|
|
44
|
+
// src/domain/model-context/context-item/item-content/item-content.ts
|
|
45
|
+
var ItemContent = class {
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
// src/
|
|
49
|
-
var InputText = class _InputText extends
|
|
48
|
+
// src/domain/model-context/context-item/item-content/input-text.ts
|
|
49
|
+
var InputText = class _InputText extends ItemContent {
|
|
50
50
|
constructor(text) {
|
|
51
51
|
super();
|
|
52
52
|
this.text = text;
|
|
@@ -68,7 +68,7 @@ var InputText = class _InputText extends Content {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
// src/
|
|
71
|
+
// src/domain/model-context/context-item/client-item/user-message.ts
|
|
72
72
|
var UserMessage = class _UserMessage extends ContextItem {
|
|
73
73
|
constructor(content) {
|
|
74
74
|
super();
|
|
@@ -93,7 +93,7 @@ var UserMessage = class _UserMessage extends ContextItem {
|
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
// src/
|
|
96
|
+
// src/domain/model-context/context-item/client-item/developer-message.ts
|
|
97
97
|
var DeveloperMessage = class _DeveloperMessage extends ContextItem {
|
|
98
98
|
constructor(content) {
|
|
99
99
|
super();
|
|
@@ -118,8 +118,8 @@ var DeveloperMessage = class _DeveloperMessage extends ContextItem {
|
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
-
// src/
|
|
122
|
-
var OutputText = class _OutputText extends
|
|
121
|
+
// src/domain/model-context/context-item/item-content/output-text.ts
|
|
122
|
+
var OutputText = class _OutputText extends ItemContent {
|
|
123
123
|
constructor(text) {
|
|
124
124
|
super();
|
|
125
125
|
this.text = text;
|
|
@@ -138,7 +138,7 @@ var OutputText = class _OutputText extends Content {
|
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
-
// src/
|
|
141
|
+
// src/domain/model-context/context-item/model-item/model-message.ts
|
|
142
142
|
var ModelMessage = class _ModelMessage extends ContextItem {
|
|
143
143
|
constructor(content) {
|
|
144
144
|
super();
|
|
@@ -159,7 +159,7 @@ var ModelMessage = class _ModelMessage extends ContextItem {
|
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
161
|
|
|
162
|
-
// src/
|
|
162
|
+
// src/domain/model-context/context-item/model-item/function-call.ts
|
|
163
163
|
var FunctionCall = class _FunctionCall extends ContextItem {
|
|
164
164
|
constructor(callId, name, args) {
|
|
165
165
|
super();
|
|
@@ -181,7 +181,7 @@ var FunctionCall = class _FunctionCall extends ContextItem {
|
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
183
|
|
|
184
|
-
// src/
|
|
184
|
+
// src/domain/model-context/context-item/model-item/reasoning.ts
|
|
185
185
|
var Reasoning = class _Reasoning extends ContextItem {
|
|
186
186
|
constructor(content, encryptedContent, summary = []) {
|
|
187
187
|
super();
|
|
@@ -204,7 +204,7 @@ var Reasoning = class _Reasoning extends ContextItem {
|
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
-
// src/
|
|
207
|
+
// src/domain/model-context/context-item/client-item/function-call-output.ts
|
|
208
208
|
var FunctionCallOutput = class _FunctionCallOutput extends ContextItem {
|
|
209
209
|
constructor(callId, output) {
|
|
210
210
|
super();
|
|
@@ -213,8 +213,8 @@ var FunctionCallOutput = class _FunctionCallOutput extends ContextItem {
|
|
|
213
213
|
this.output = output;
|
|
214
214
|
}
|
|
215
215
|
static create(callId, output) {
|
|
216
|
-
const
|
|
217
|
-
return new _FunctionCallOutput(callId,
|
|
216
|
+
const outputText = InputText.create(output);
|
|
217
|
+
return new _FunctionCallOutput(callId, outputText);
|
|
218
218
|
}
|
|
219
219
|
static rehydrate(data) {
|
|
220
220
|
return new _FunctionCallOutput(data.callId, data.output);
|
|
@@ -223,12 +223,12 @@ var FunctionCallOutput = class _FunctionCallOutput extends ContextItem {
|
|
|
223
223
|
return {
|
|
224
224
|
type: this.type,
|
|
225
225
|
call_id: this.callId,
|
|
226
|
-
output: this.output.
|
|
226
|
+
output: this.output.toJSON()
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
229
|
};
|
|
230
230
|
|
|
231
|
-
// src/
|
|
231
|
+
// src/domain/generative-model/inference-response.ts
|
|
232
232
|
var InferenceResponse = class {
|
|
233
233
|
constructor(contextItems, tokenUsage) {
|
|
234
234
|
this.contextItems = contextItems;
|
|
@@ -236,7 +236,7 @@ var InferenceResponse = class {
|
|
|
236
236
|
}
|
|
237
237
|
};
|
|
238
238
|
|
|
239
|
-
// src/
|
|
239
|
+
// src/domain/generative-model/token-usage.ts
|
|
240
240
|
var InputTokenDetails = class {
|
|
241
241
|
constructor(cached_tokens) {
|
|
242
242
|
this.cached_tokens = cached_tokens;
|
|
@@ -257,7 +257,7 @@ var TokenUsage = class {
|
|
|
257
257
|
}
|
|
258
258
|
};
|
|
259
259
|
|
|
260
|
-
// src/providers/openai/runtime/openai-responses.ts
|
|
260
|
+
// src/infrastructure/providers/openai/runtime/openai-responses.ts
|
|
261
261
|
import OpenAI from "openai";
|
|
262
262
|
var OpenAIResponses = class {
|
|
263
263
|
constructor() {
|
|
@@ -324,7 +324,7 @@ var OpenAIResponses = class {
|
|
|
324
324
|
}
|
|
325
325
|
};
|
|
326
326
|
|
|
327
|
-
// src/
|
|
327
|
+
// src/domain/generative-model/inference-request.ts
|
|
328
328
|
var InferenceRequest = class {
|
|
329
329
|
constructor(model, context) {
|
|
330
330
|
this.model = model;
|
|
@@ -332,7 +332,7 @@ var InferenceRequest = class {
|
|
|
332
332
|
}
|
|
333
333
|
};
|
|
334
334
|
|
|
335
|
-
// src/providers/openai/reasoning-effort.ts
|
|
335
|
+
// src/infrastructure/providers/openai/reasoning-effort.ts
|
|
336
336
|
var OpenAIReasoningEffort = class {
|
|
337
337
|
constructor(reasoningEffort) {
|
|
338
338
|
this.reasoningEffort = reasoningEffort;
|
|
@@ -348,7 +348,7 @@ var OpenAIReasoningEffort = class {
|
|
|
348
348
|
}
|
|
349
349
|
};
|
|
350
350
|
|
|
351
|
-
// src/providers/openai/models/gpt-5-4-nano.ts
|
|
351
|
+
// src/infrastructure/providers/openai/models/gpt-5-4-nano.ts
|
|
352
352
|
var Gpt54Nano = class {
|
|
353
353
|
constructor() {
|
|
354
354
|
this.specification = {
|
|
@@ -379,7 +379,7 @@ var Gpt54Nano = class {
|
|
|
379
379
|
}
|
|
380
380
|
};
|
|
381
381
|
|
|
382
|
-
// src/providers/openai/models/gpt-5-4.ts
|
|
382
|
+
// src/infrastructure/providers/openai/models/gpt-5-4.ts
|
|
383
383
|
var Gpt54 = class {
|
|
384
384
|
constructor() {
|
|
385
385
|
this.specification = {
|
|
@@ -410,7 +410,7 @@ var Gpt54 = class {
|
|
|
410
410
|
}
|
|
411
411
|
};
|
|
412
412
|
|
|
413
|
-
// src/providers/openai/models/gpt-5-4-mini.ts
|
|
413
|
+
// src/infrastructure/providers/openai/models/gpt-5-4-mini.ts
|
|
414
414
|
var Gpt54Mini = class {
|
|
415
415
|
constructor() {
|
|
416
416
|
this.specification = {
|
|
@@ -441,7 +441,7 @@ var Gpt54Mini = class {
|
|
|
441
441
|
}
|
|
442
442
|
};
|
|
443
443
|
|
|
444
|
-
// src/
|
|
444
|
+
// src/domain/agent-loop/rules/condition/condition.ts
|
|
445
445
|
var BaseCondition = class {
|
|
446
446
|
and(other) {
|
|
447
447
|
return new AndCondition(this, other);
|
|
@@ -483,7 +483,7 @@ var OrCondition = class extends BaseCondition {
|
|
|
483
483
|
}
|
|
484
484
|
};
|
|
485
485
|
|
|
486
|
-
// src/
|
|
486
|
+
// src/domain/agent-loop/rules/rule/rule.ts
|
|
487
487
|
var If = class {
|
|
488
488
|
constructor({ condition, action }) {
|
|
489
489
|
this.condition = condition;
|
|
@@ -509,7 +509,7 @@ var Loop = class {
|
|
|
509
509
|
}
|
|
510
510
|
};
|
|
511
511
|
|
|
512
|
-
// src/
|
|
512
|
+
// src/infrastructure/repository/in-memory-context-repository.ts
|
|
513
513
|
var InMemoryContextRepository = class {
|
|
514
514
|
constructor() {
|
|
515
515
|
this.store = /* @__PURE__ */ new Map();
|
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\tcall_id: 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: string[]): FunctionCallOutput {\n\t\tconst outputTexts = output.map((o) => InputText.create(o))\n\t\treturn new FunctionCallOutput(callId, outputTexts)\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\tcall_id: 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.role === \"assistant\") {\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\") {\n\t\t\t\treturn FunctionCall.rehydrate({\n\t\t\t\t\tcallId: item.call_id,\n\t\t\t\t\tname: item.name,\n\t\t\t\t\targs: item.arguments,\n\t\t\t\t})\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 AsyncAction<T> {\n\tapply(candidate: T): Promise<T>\n}\n\nexport interface Rule<T> {\n\tcondition: Condition<T>\n\taction: AsyncAction<T>\n\tapply(candidate: T): T\n}\n\nexport interface AsyncRule<T> {\n\tcondition: Condition<T>\n\taction: AsyncAction<T>\n\tapply(candidate: T): Promise<T>\n}\n\nexport class If<T> implements AsyncRule<T> {\n\tcondition: Condition<T>\n\taction: AsyncAction<T>\n\n\tconstructor({ condition, action }: { condition: Condition<T>; action: AsyncAction<T> }) {\n\t\tthis.condition = condition\n\t\tthis.action = action\n\t}\n\n\tasync apply(candidate: T): Promise<T> {\n\t\tif (this.condition.isSatisfiedBy(candidate)) {\n\t\t\treturn await this.action.apply(candidate)\n\t\t}\n\t\treturn candidate\n\t}\n}\n\nexport class Loop<T> implements AsyncRule<T> {\n\tcondition: Condition<T>\n\taction: AsyncAction<T>\n\n\tconstructor({ condition, action }: { condition: Condition<T>; action: AsyncAction<T> }) {\n\t\tthis.condition = condition\n\t\tthis.action = action\n\t}\n\n\tasync apply(candidate: T): Promise<T> {\n\t\twhile (this.condition.isSatisfiedBy(candidate)) {\n\t\t\tcandidate = await 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,EA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,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/domain/model-context/context.ts","../src/domain/model-context/context-item/context-item.ts","../src/domain/model-context/context-item/item-content/item-content.ts","../src/domain/model-context/context-item/item-content/input-text.ts","../src/domain/model-context/context-item/client-item/user-message.ts","../src/domain/model-context/context-item/client-item/developer-message.ts","../src/domain/model-context/context-item/item-content/output-text.ts","../src/domain/model-context/context-item/model-item/model-message.ts","../src/domain/model-context/context-item/model-item/function-call.ts","../src/domain/model-context/context-item/model-item/reasoning.ts","../src/domain/model-context/context-item/client-item/function-call-output.ts","../src/domain/generative-model/inference-response.ts","../src/domain/generative-model/token-usage.ts","../src/infrastructure/providers/openai/runtime/openai-responses.ts","../src/domain/generative-model/inference-request.ts","../src/infrastructure/providers/openai/reasoning-effort.ts","../src/infrastructure/providers/openai/models/gpt-5-4-nano.ts","../src/infrastructure/providers/openai/models/gpt-5-4.ts","../src/infrastructure/providers/openai/models/gpt-5-4-mini.ts","../src/domain/agent-loop/rules/condition/condition.ts","../src/domain/agent-loop/rules/rule/rule.ts","../src/infrastructure/repository/in-memory-context-repository.ts"],"sourcesContent":["import { ContextItem } from \"@domain/model-context/context-item/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 ItemContent {\n\tabstract readonly type: string\n}\n","import { ItemContent } from \"@domain/model-context/context-item/item-content/item-content\"\n\nexport class InputText extends ItemContent {\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 \"@domain/model-context/context-item/context-item\"\nimport { InputText } from \"@domain/model-context/context-item/item-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 \"@domain/model-context/context-item/item-content/input-text\"\nimport { ContextItem } from \"@domain/model-context/context-item/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 { ItemContent } from \"@domain/model-context/context-item/item-content/item-content\"\n\nexport class OutputText extends ItemContent {\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 \"@domain/model-context/context-item/context-item\"\nimport { OutputText } from \"@domain/model-context/context-item/item-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 \"@domain/model-context/context-item/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\tcall_id: this.callId,\n\t\t\tname: this.name,\n\t\t\targuments: this.args,\n\t\t}\n\t}\n}\n","import { InputText } from \"@domain/model-context/context-item/item-content/input-text\"\nimport { SummaryText } from \"@domain/model-context/context-item/item-content/summary-text\"\nimport { ContextItem } from \"@domain/model-context/context-item/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 \"@domain/model-context/context-item/context-item\"\nimport { InputText } from \"@domain/model-context/context-item/item-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: string): FunctionCallOutput {\n\t\tconst outputText = InputText.create(output)\n\t\treturn new FunctionCallOutput(callId, outputText)\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\tcall_id: this.callId,\n\t\t\toutput: this.output.toJSON(),\n\t\t}\n\t}\n}\n","import { ContextItem } from \"@domain/model-context/context-item/context-item\"\nimport { TokenUsage } from \"@domain/generative-model/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 \"@domain/model-context/context\"\nimport { ContextItem } from \"@domain/model-context/context-item/context-item\"\nimport { FunctionCall } from \"@domain/model-context/context-item/model-item/function-call\"\nimport { ModelMessage } from \"@domain/model-context/context-item/model-item/model-message\"\nimport { Reasoning } from \"@domain/model-context/context-item/model-item/reasoning\"\nimport { InferenceRequest } from \"@domain/generative-model/inference-request\"\nimport { InferenceResponse } from \"@domain/generative-model/inference-response\"\nimport { ModelRuntime } from \"@domain/generative-model/runtime/model-runtime\"\nimport { InputTokenDetails, OutputTokenDetails, TokenUsage } from \"@domain/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.role === \"assistant\") {\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\") {\n\t\t\t\treturn FunctionCall.rehydrate({\n\t\t\t\t\tcallId: item.call_id,\n\t\t\t\t\tname: item.name,\n\t\t\t\t\targs: item.arguments,\n\t\t\t\t})\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 \"@domain/model-context/context\"\nimport { GenerativeModel } from \"@domain/generative-model/generative-model\"\nimport { ReasoningEffort } from \"@domain/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@domain/generative-model/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 \"@domain/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 \"@domain/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@domain/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@domain/generative-model/generative-model\"\nimport { Tool } from \"@domain/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@infra/providers/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 \"@domain/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@domain/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@domain/generative-model/generative-model\"\nimport { Tool } from \"@domain/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@infra/providers/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 \"@domain/generative-model/capabilities/reasoning-effort\"\nimport { ToolCallingCapability } from \"@domain/generative-model/capabilities/tool-calling\"\nimport { GenerativeModel } from \"@domain/generative-model/generative-model\"\nimport { Tool } from \"@domain/generative-model/tool\"\nimport { OpenAIReasoningEffort, OpenAIReasoningEffortType } from \"@infra/providers/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 \"@domain/agent-loop/rules/condition/condition\"\n\nexport interface Action<T> {\n\tapply(candidate: T): T\n}\n\nexport interface AsyncAction<T> {\n\tapply(candidate: T): Promise<T>\n}\n\nexport interface AsyncRule<T> {\n\tcondition: Condition<T>\n\taction: AsyncAction<T>\n\tapply(candidate: T): Promise<T>\n}\n\nexport class If<T> implements AsyncRule<T> {\n\tcondition: Condition<T>\n\taction: AsyncAction<T>\n\n\tconstructor({ condition, action }: { condition: Condition<T>; action: AsyncAction<T> }) {\n\t\tthis.condition = condition\n\t\tthis.action = action\n\t}\n\n\tasync apply(candidate: T): Promise<T> {\n\t\tif (this.condition.isSatisfiedBy(candidate)) {\n\t\t\treturn await this.action.apply(candidate)\n\t\t}\n\t\treturn candidate\n\t}\n}\n\nexport class Loop<T> implements AsyncRule<T> {\n\tcondition: Condition<T>\n\taction: AsyncAction<T>\n\n\tconstructor({ condition, action }: { condition: Condition<T>; action: AsyncAction<T> }) {\n\t\tthis.condition = condition\n\t\tthis.action = action\n\t}\n\n\tasync apply(candidate: T): Promise<T> {\n\t\twhile (this.condition.isSatisfiedBy(candidate)) {\n\t\t\tcandidate = await this.action.apply(candidate)\n\t\t}\n\t\treturn candidate\n\t}\n}\n","import { Context } from \"@domain/model-context/context\"\nimport { ContextRepository } from \"@domain/model-context/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,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,I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|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "A TypeScript framework for building AI agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|