@mappies/miniwat-agent 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -26,7 +26,16 @@ module.exports = __toCommonJS(index_exports);
26
26
 
27
27
  // src/entities/agent.ts
28
28
  var Agent = class {
29
- constructor() {
29
+ constructor(config) {
30
+ this.model = config.model;
31
+ this.instruction = config.instruction;
32
+ this.toolDispatcher = config.toolDispatcher;
33
+ }
34
+ async invoke(session, option) {
35
+ return await this.model.invoke(session.messages, { ...option, instruction: this.instruction });
36
+ }
37
+ async stream(session, option) {
38
+ return await this.model.stream(session.messages, { ...option, instruction: this.instruction });
30
39
  }
31
40
  };
32
41
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/entities/agent.ts"],"sourcesContent":["export { Agent } from './entities/agent';","export class Agent\n{\n constructor()\n {\n \n } \n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,QAAN,MACP;AAAA,EACI,cACA;AAAA,EAEA;AACJ;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/entities/agent.ts"],"sourcesContent":["export { Agent } from './entities/agent';\nexport { AgentConfig } from './entities/agentConfig';\nexport { Session } from './entities/session';","import { Model, ModelOption, ResponseMessage, Instruction } from \"@mappies/miniwat-agent-core\";\nimport { AgentConfig } from \"./agentConfig\";\nimport { ToolDispatcher } from \"@mappies/miniwat-mcp-core\";\nimport { Readable } from \"stream\";\nimport { Session } from \"./session\";\n\nexport class Agent\n{\n public readonly instruction: Instruction\n public readonly model: Model;\n public readonly toolDispatcher?: ToolDispatcher;\n\n constructor(config: AgentConfig)\n {\n this.model = config.model;\n this.instruction = config.instruction;\n this.toolDispatcher = config.toolDispatcher;\n }\n\n async invoke(session: Session, option?: Omit<ModelOption, 'instruction'>): Promise<ResponseMessage>\n {\n return await this.model.invoke(session.messages, {...option, instruction: this.instruction});\n }\n\n async stream(session: Session, option?: Omit<ModelOption, 'instruction'>): Promise<Readable>\n {\n return await this.model.stream(session.messages, {...option, instruction: this.instruction});\n }\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMO,IAAM,QAAN,MACP;AAAA,EAKI,YAAY,QACZ;AACI,SAAK,QAAQ,OAAO;AACpB,SAAK,cAAc,OAAO;AAC1B,SAAK,iBAAiB,OAAO;AAAA,EACjC;AAAA,EAEA,MAAM,OAAO,SAAkB,QAC/B;AACI,WAAO,MAAM,KAAK,MAAM,OAAO,QAAQ,UAAU,EAAC,GAAG,QAAQ,aAAa,KAAK,YAAW,CAAC;AAAA,EAC/F;AAAA,EAEA,MAAM,OAAO,SAAkB,QAC/B;AACI,WAAO,MAAM,KAAK,MAAM,OAAO,QAAQ,UAAU,EAAC,GAAG,QAAQ,aAAa,KAAK,YAAW,CAAC;AAAA,EAC/F;AACJ;","names":[]}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,33 @@
1
+ import { Instruction, Model, Message, ModelOption, ResponseMessage } from '@mappies/miniwat-agent-core';
2
+ import { ToolDispatcher } from '@mappies/miniwat-mcp-core';
3
+ import { Readable } from 'stream';
4
+
5
+ interface AgentConfig {
6
+ /**
7
+ * Agent instruction
8
+ */
9
+ instruction: Instruction;
10
+ /**
11
+ * The language model used by this agent.
12
+ */
13
+ model: Model;
14
+ /**
15
+ * Tool dispatcher for tools.
16
+ */
17
+ toolDispatcher?: ToolDispatcher;
18
+ }
19
+
20
+ interface Session {
21
+ messages: Message[];
22
+ }
23
+
1
24
  declare class Agent {
2
- constructor();
25
+ readonly instruction: Instruction;
26
+ readonly model: Model;
27
+ readonly toolDispatcher?: ToolDispatcher;
28
+ constructor(config: AgentConfig);
29
+ invoke(session: Session, option?: Omit<ModelOption, 'instruction'>): Promise<ResponseMessage>;
30
+ stream(session: Session, option?: Omit<ModelOption, 'instruction'>): Promise<Readable>;
3
31
  }
4
32
 
5
- export { Agent };
33
+ export { Agent, type AgentConfig, type Session };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,33 @@
1
+ import { Instruction, Model, Message, ModelOption, ResponseMessage } from '@mappies/miniwat-agent-core';
2
+ import { ToolDispatcher } from '@mappies/miniwat-mcp-core';
3
+ import { Readable } from 'stream';
4
+
5
+ interface AgentConfig {
6
+ /**
7
+ * Agent instruction
8
+ */
9
+ instruction: Instruction;
10
+ /**
11
+ * The language model used by this agent.
12
+ */
13
+ model: Model;
14
+ /**
15
+ * Tool dispatcher for tools.
16
+ */
17
+ toolDispatcher?: ToolDispatcher;
18
+ }
19
+
20
+ interface Session {
21
+ messages: Message[];
22
+ }
23
+
1
24
  declare class Agent {
2
- constructor();
25
+ readonly instruction: Instruction;
26
+ readonly model: Model;
27
+ readonly toolDispatcher?: ToolDispatcher;
28
+ constructor(config: AgentConfig);
29
+ invoke(session: Session, option?: Omit<ModelOption, 'instruction'>): Promise<ResponseMessage>;
30
+ stream(session: Session, option?: Omit<ModelOption, 'instruction'>): Promise<Readable>;
3
31
  }
4
32
 
5
- export { Agent };
33
+ export { Agent, type AgentConfig, type Session };
package/dist/index.js CHANGED
@@ -1,6 +1,15 @@
1
1
  // src/entities/agent.ts
2
2
  var Agent = class {
3
- constructor() {
3
+ constructor(config) {
4
+ this.model = config.model;
5
+ this.instruction = config.instruction;
6
+ this.toolDispatcher = config.toolDispatcher;
7
+ }
8
+ async invoke(session, option) {
9
+ return await this.model.invoke(session.messages, { ...option, instruction: this.instruction });
10
+ }
11
+ async stream(session, option) {
12
+ return await this.model.stream(session.messages, { ...option, instruction: this.instruction });
4
13
  }
5
14
  };
6
15
  export {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/entities/agent.ts"],"sourcesContent":["export class Agent\n{\n constructor()\n {\n \n } \n}"],"mappings":";AAAO,IAAM,QAAN,MACP;AAAA,EACI,cACA;AAAA,EAEA;AACJ;","names":[]}
1
+ {"version":3,"sources":["../src/entities/agent.ts"],"sourcesContent":["import { Model, ModelOption, ResponseMessage, Instruction } from \"@mappies/miniwat-agent-core\";\nimport { AgentConfig } from \"./agentConfig\";\nimport { ToolDispatcher } from \"@mappies/miniwat-mcp-core\";\nimport { Readable } from \"stream\";\nimport { Session } from \"./session\";\n\nexport class Agent\n{\n public readonly instruction: Instruction\n public readonly model: Model;\n public readonly toolDispatcher?: ToolDispatcher;\n\n constructor(config: AgentConfig)\n {\n this.model = config.model;\n this.instruction = config.instruction;\n this.toolDispatcher = config.toolDispatcher;\n }\n\n async invoke(session: Session, option?: Omit<ModelOption, 'instruction'>): Promise<ResponseMessage>\n {\n return await this.model.invoke(session.messages, {...option, instruction: this.instruction});\n }\n\n async stream(session: Session, option?: Omit<ModelOption, 'instruction'>): Promise<Readable>\n {\n return await this.model.stream(session.messages, {...option, instruction: this.instruction});\n }\n}"],"mappings":";AAMO,IAAM,QAAN,MACP;AAAA,EAKI,YAAY,QACZ;AACI,SAAK,QAAQ,OAAO;AACpB,SAAK,cAAc,OAAO;AAC1B,SAAK,iBAAiB,OAAO;AAAA,EACjC;AAAA,EAEA,MAAM,OAAO,SAAkB,QAC/B;AACI,WAAO,MAAM,KAAK,MAAM,OAAO,QAAQ,UAAU,EAAC,GAAG,QAAQ,aAAa,KAAK,YAAW,CAAC;AAAA,EAC/F;AAAA,EAEA,MAAM,OAAO,SAAkB,QAC/B;AACI,WAAO,MAAM,KAAK,MAAM,OAAO,QAAQ,UAAU,EAAC,GAAG,QAAQ,aAAa,KAAK,YAAW,CAAC;AAAA,EAC/F;AACJ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappies/miniwat-agent",
3
- "version": "0.0.0",
3
+ "version": "0.1.0",
4
4
  "description": "Miniwat Agent",
5
5
  "homepage": "https://gitlab.com/mappies/miniwat-agent#readme",
6
6
  "bugs": {
@@ -41,5 +41,9 @@
41
41
  "tsup": "^8.5.1",
42
42
  "typescript": "^5.9.3",
43
43
  "vitest": "^4.1.0"
44
+ },
45
+ "dependencies": {
46
+ "@mappies/miniwat-agent-core": "^0.13.0",
47
+ "@mappies/miniwat-mcp-core": "^0.7.0"
44
48
  }
45
49
  }