@jsm-mit/agent-platform-canister-package 0.0.2 → 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.
@@ -1,6 +1,5 @@
1
1
  type UpsertAgentConfigArgs =
2
2
  record {
3
- channelType: ChannelType;
4
3
  customConfigJson: opt text;
5
4
  disclosesAsAi: bool;
6
5
  id: AgentId;
@@ -89,16 +88,10 @@ type ChatMessage =
89
88
  toolCallId: opt text;
90
89
  toolName: opt text;
91
90
  };
92
- type ChannelType =
93
- variant {
94
- chat;
95
- whatsapp;
96
- };
97
91
  type AppendMessageBatchArgs = record {entries: vec MessageBatchEntry;};
98
92
  type AgentId = text;
99
93
  type AgentConfig =
100
94
  record {
101
- channelType: opt ChannelType;
102
95
  createdAt: int;
103
96
  customConfigJson: opt text;
104
97
  disclosesAsAi: bool;
@@ -5,7 +5,6 @@ import type { IDL } from "@icp-sdk/core/candid";
5
5
  export interface AgentConfig {
6
6
  id: AgentId;
7
7
  tools: Array<ToolBinding>;
8
- channelType: [] | [ChannelType];
9
8
  name: string;
10
9
  createdAt: bigint;
11
10
  updatedAt: bigint;
@@ -17,7 +16,6 @@ export type AgentId = string;
17
16
  export interface AppendMessageBatchArgs {
18
17
  entries: Array<MessageBatchEntry>;
19
18
  }
20
- export type ChannelType = { chat: null } | { whatsapp: null };
21
19
  export interface ChatMessage {
22
20
  content: string;
23
21
  role: ChatMessageRole;
@@ -63,7 +61,6 @@ export interface ToolBinding {
63
61
  export interface UpsertAgentConfigArgs {
64
62
  id: AgentId;
65
63
  tools: Array<ToolBinding>;
66
- channelType: ChannelType;
67
64
  name: string;
68
65
  persona: string;
69
66
  disclosesAsAi: boolean;
@@ -41,11 +41,9 @@ export const idlFactory = ({ IDL }) => {
41
41
  paramsJson: IDL.Text,
42
42
  tool: IDL.Text,
43
43
  });
44
- const ChannelType = IDL.Variant({ chat: IDL.Null, whatsapp: IDL.Null });
45
44
  const AgentConfig = IDL.Record({
46
45
  id: AgentId,
47
46
  tools: IDL.Vec(ToolBinding),
48
- channelType: IDL.Opt(ChannelType),
49
47
  name: IDL.Text,
50
48
  createdAt: IDL.Int,
51
49
  updatedAt: IDL.Int,
@@ -64,7 +62,6 @@ export const idlFactory = ({ IDL }) => {
64
62
  const UpsertAgentConfigArgs = IDL.Record({
65
63
  id: AgentId,
66
64
  tools: IDL.Vec(ToolBinding),
67
- channelType: ChannelType,
68
65
  name: IDL.Text,
69
66
  persona: IDL.Text,
70
67
  disclosesAsAi: IDL.Bool,
@@ -8,8 +8,7 @@ export declare class AgentConfigsActor extends ActorBase {
8
8
  * Creates the config on first write, otherwise updates it in place —
9
9
  * `createdAt` is preserved across an update. Admin only.
10
10
  * @param input - The full desired config; `id` decides create-vs-update. `tools`
11
- * defaults to [] (a tool-less agent) when omitted. `channelType` is required —
12
- * every agent must declare which outbound channel it uses.
11
+ * defaults to [] (a tool-less agent) when omitted.
13
12
  * @returns The stored config as it now stands.
14
13
  * @throws Error with message `CanisterError` when the canister returns a business error (not authorized, or `InvalidData` — a bounded field was too long/too many entries). Examine "cause" for {errorKey, errorMessage, logs}.
15
14
  * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
@@ -1 +1 @@
1
- {"version":3,"file":"agent-configs-actor.d.ts","sourceRoot":"","sources":["../../src/actors/agent-configs-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAGhF,6DAA6D;AAC7D,qBAAa,iBAAkB,SAAQ,SAAS;gBAChC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD;;;;;;;;;;OAUG;IACU,4BAA4B,CACrC,KAAK,EAAE,sBAAsB,GAC9B,OAAO,CAAC,eAAe,CAAC;IAe3B;;;;;;OAMG;IACU,yBAAyB,CAClC,EAAE,EAAE,MAAM,GACX,OAAO,CAAC,eAAe,CAAC;IAO3B;;;;;;;OAOG;IACU,2BAA2B,CACpC,KAAK,EAAE,MAAM,GACd,OAAO,CAAC,eAAe,EAAE,CAAC;IAO7B;;;;;;OAMG;IACU,4BAA4B,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKvE"}
1
+ {"version":3,"file":"agent-configs-actor.d.ts","sourceRoot":"","sources":["../../src/actors/agent-configs-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAGhF,6DAA6D;AAC7D,qBAAa,iBAAkB,SAAQ,SAAS;gBAChC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAInD;;;;;;;;;OASG;IACU,4BAA4B,CACrC,KAAK,EAAE,sBAAsB,GAC9B,OAAO,CAAC,eAAe,CAAC;IAc3B;;;;;;OAMG;IACU,yBAAyB,CAClC,EAAE,EAAE,MAAM,GACX,OAAO,CAAC,eAAe,CAAC;IAO3B;;;;;;;OAOG;IACU,2BAA2B,CACpC,KAAK,EAAE,MAAM,GACd,OAAO,CAAC,eAAe,EAAE,CAAC;IAO7B;;;;;;OAMG;IACU,4BAA4B,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKvE"}
@@ -1,6 +1,6 @@
1
1
  import {} from "@icp-sdk/core/agent";
2
2
  import { ActorBase } from "../actor-base.js";
3
- import { mapAgentConfigView, toChannelTypeVariant, toOpt } from "../mappers.js";
3
+ import { mapAgentConfigView, toOpt } from "../mappers.js";
4
4
  /** 1:1 wrapper for the canister's AgentConfigsController. */
5
5
  export class AgentConfigsActor extends ActorBase {
6
6
  constructor(canisterId, identity) {
@@ -10,8 +10,7 @@ export class AgentConfigsActor extends ActorBase {
10
10
  * Creates the config on first write, otherwise updates it in place —
11
11
  * `createdAt` is preserved across an update. Admin only.
12
12
  * @param input - The full desired config; `id` decides create-vs-update. `tools`
13
- * defaults to [] (a tool-less agent) when omitted. `channelType` is required —
14
- * every agent must declare which outbound channel it uses.
13
+ * defaults to [] (a tool-less agent) when omitted.
15
14
  * @returns The stored config as it now stands.
16
15
  * @throws Error with message `CanisterError` when the canister returns a business error (not authorized, or `InvalidData` — a bounded field was too long/too many entries). Examine "cause" for {errorKey, errorMessage, logs}.
17
16
  * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
@@ -25,7 +24,6 @@ export class AgentConfigsActor extends ActorBase {
25
24
  disclosesAsAi: input.disclosesAsAi,
26
25
  tools: input.tools ?? [],
27
26
  customConfigJson: toOpt(input.customConfigJson),
28
- channelType: toChannelTypeVariant(input.channelType),
29
27
  }));
30
28
  return mapAgentConfigView(config);
31
29
  }
@@ -1,8 +1,4 @@
1
1
  export type ChatMessageRoleView = "user" | "assistant" | "tool";
2
- /** Which outbound channel an agent's replies go out on — decided once at creation,
3
- * per AGENT-PLATFORM decision 2026-08-19. "chat" is accepted/stored but nothing
4
- * downstream acts on it yet — only "whatsapp" is implemented (agents-village). */
5
- export type ChannelTypeView = "whatsapp" | "chat";
6
2
  /** Candid `ChatMessage` with the role variant as a string union and opts flattened —
7
3
  * matches chat-agent-package's own ChatMessage shape so history round-trips without
8
4
  * further translation on the consumer side. */
@@ -37,10 +33,12 @@ export interface AgentConfigView {
37
33
  tool: string;
38
34
  paramsJson: string;
39
35
  }[];
36
+ /** Escape hatch for whatever doesn't fit the schema yet — JSON-encoded object,
37
+ * interpreted only by whatever agent-specific code reads it. As of AGENT-PLATFORM
38
+ * decision 2026-08-19, an agent's outbound channel config lives here too (e.g.
39
+ * {"type":"whatsapp","number":...,"peers":[...]}) — this package stays agnostic
40
+ * to its shape; agents-village is the one that parses it. */
40
41
  customConfigJson?: string;
41
- /** Undefined only for an agent created before this field existed and not yet
42
- * re-saved — every agent upserted through UpsertAgentConfigInput always has one. */
43
- channelType?: ChannelTypeView;
44
42
  /** Nanoseconds since epoch */
45
43
  createdAt: bigint;
46
44
  /** Nanoseconds since epoch */
@@ -50,8 +48,7 @@ export interface AgentConfigView {
50
48
  * plain optional (candid `opt` shaping done by the wrapper); tools is optional here
51
49
  * even though the canister's own UpsertAgentConfigArgs requires it — the wrapper
52
50
  * defaults a missing tools to [] for a tool-less agent, so callers don't have to
53
- * spell out `tools: []` every time. channelType is required — the canister's own
54
- * UpsertAgentConfigArgs requires it too, per AGENT-PLATFORM decision 2026-08-19. */
51
+ * spell out `tools: []` every time. */
55
52
  export interface UpsertAgentConfigInput {
56
53
  id: string;
57
54
  name: string;
@@ -62,6 +59,5 @@ export interface UpsertAgentConfigInput {
62
59
  paramsJson: string;
63
60
  }[];
64
61
  customConfigJson?: string;
65
- channelType: ChannelTypeView;
66
62
  }
67
63
  //# sourceMappingURL=interfaces.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;AAEhE;;kFAEkF;AAClF,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,MAAM,CAAC;AAElD;;+CAE+C;AAC/C,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;wEACwE;AACxE,MAAM,WAAW,sBAAsB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,E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ChatMessage, ChatMessageRole } from "../declarations/agent-platform-canister/agent-platform-canister.did.js";
2
- import type { ChannelTypeView, ChatMessageRoleView, ChatMessageView, AgentConfigView } from "./interfaces.js";
1
+ import type { AgentConfig, ChatMessage, ChatMessageRole } from "../declarations/agent-platform-canister/agent-platform-canister.did.js";
2
+ import type { ChatMessageRoleView, ChatMessageView, AgentConfigView } from "./interfaces.js";
3
3
  declare function toOpt<T>(value: T | undefined): [] | [T];
4
4
  export declare function mapChatMessageRoleView(role: ChatMessageRole): ChatMessageRoleView;
5
5
  export declare function toChatMessageRoleVariant(role: ChatMessageRoleView): ChatMessageRole;
6
6
  export declare function mapChatMessageView(message: ChatMessage): ChatMessageView;
7
- export declare function mapChannelTypeView(channelType: ChannelType): ChannelTypeView;
8
- export declare function toChannelTypeVariant(channelType: ChannelTypeView): ChannelType;
9
7
  export declare function mapAgentConfigView(config: AgentConfig): AgentConfigView;
10
8
  export { toOpt };
11
9
  //# sourceMappingURL=mappers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,EACX,WAAW,EACX,WAAW,EACX,eAAe,EAClB,MAAM,wEAAwE,CAAC;AAChF,OAAO,KAAK,EACR,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,eAAe,EAClB,MAAM,iBAAiB,CAAC;AAMzB,iBAAS,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAEhD;AAED,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,eAAe,GACtB,mBAAmB,CAErB;AAED,wBAAgB,wBAAwB,CACpC,IAAI,EAAE,mBAAmB,GAC1B,eAAe,CAEjB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,eAAe,CAQxE;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,WAAW,GAAG,eAAe,CAE5E;AAED,wBAAgB,oBAAoB,CAChC,WAAW,EAAE,eAAe,GAC7B,WAAW,CAEb;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,eAAe,CAiBvE;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,EACX,WAAW,EACX,eAAe,EAClB,MAAM,wEAAwE,CAAC;AAChF,OAAO,KAAK,EACR,mBAAmB,EACnB,eAAe,EACf,eAAe,EAClB,MAAM,iBAAiB,CAAC;AAMzB,iBAAS,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAEhD;AAED,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,eAAe,GACtB,mBAAmB,CAErB;AAED,wBAAgB,wBAAwB,CACpC,IAAI,EAAE,mBAAmB,GAC1B,eAAe,CAEjB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,eAAe,CAQxE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,eAAe,CAWvE;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
package/dist/mappers.js CHANGED
@@ -19,14 +19,7 @@ export function mapChatMessageView(message) {
19
19
  timestamp: message.timestamp,
20
20
  };
21
21
  }
22
- export function mapChannelTypeView(channelType) {
23
- return Object.keys(channelType)[0];
24
- }
25
- export function toChannelTypeVariant(channelType) {
26
- return { [channelType]: null };
27
- }
28
22
  export function mapAgentConfigView(config) {
29
- const channelType = fromOpt(config.channelType);
30
23
  return {
31
24
  id: config.id,
32
25
  name: config.name,
@@ -34,9 +27,6 @@ export function mapAgentConfigView(config) {
34
27
  disclosesAsAi: config.disclosesAsAi,
35
28
  tools: config.tools,
36
29
  customConfigJson: fromOpt(config.customConfigJson),
37
- channelType: channelType !== undefined
38
- ? mapChannelTypeView(channelType)
39
- : undefined,
40
30
  createdAt: config.createdAt,
41
31
  updatedAt: config.updatedAt,
42
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsm-mit/agent-platform-canister-package",
3
- "version": "0.0.2",
3
+ "version": "0.1.0",
4
4
  "description": "Wrapper TypeScript package for the agent-platform-canister canister.",
5
5
  "license": "ISC",
6
6
  "author": "",