@jsm-mit/agent-platform-canister-package 0.2.0 → 0.4.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 CHANGED
@@ -90,6 +90,57 @@ const history = await chatHistoryActor.getConversationHistoryAsyncUnsafe(
90
90
  );
91
91
  ```
92
92
 
93
+ ### Config change notifications (0.3.0)
94
+
95
+ The canister can report every real create, change or delete of an agent config
96
+ as one task on a rabbit-motoko channel, so agents-village reloads only that
97
+ agent. `commonId` is the agent id, the payload is
98
+ `{"agentId":"<id>","change":"upserted"|"deleted"}`. Writing identical values
99
+ and refused writes report nothing; a failed report is only logged on the
100
+ canister, the write stands. The agent-platform canister must be allowed to add
101
+ tasks on the channel in rabbit. Admin only.
102
+
103
+ ```typescript
104
+ await adminActor.setConfigChangeNotificationsAsyncUnsafe({
105
+ rabbitCanisterId: "6aigz-vyaaa-aaaag-ayjqa-cai",
106
+ channel: "agent-config-changes",
107
+ });
108
+ const settings = await adminActor.getConfigChangeNotificationsAsyncUnsafe(); // or null
109
+ await adminActor.setConfigChangeNotificationsAsyncUnsafe(null); // switch off
110
+ ```
111
+
112
+ ### Agent placement: village and tags (0.4.0)
113
+
114
+ Every agent lives in a **village** — the agents-village process that runs it,
115
+ `"Development"` unless placed elsewhere — and wears **tags**, labels the
116
+ dashboard filters by (the canister attaches no meaning to them). Both come back
117
+ on every `AgentConfigView`. On upsert they are optional: left out, a create lands
118
+ in `"Development"` with no tags and an update keeps what is stored, so a caller
119
+ that never heard of villages cannot move an agent. `setAgentTagsAsyncUnsafe`
120
+ replaces the tags alone (the creating app and admins); a different set counts as
121
+ a config change and is reported like any other.
122
+
123
+ ```typescript
124
+ const placed = await agentConfigsActor.upsertAgentConfigAsyncUnsafe({
125
+ id: "kasia",
126
+ name: "Kasia",
127
+ persona: "...",
128
+ disclosesAsAi: true,
129
+ village: "SultanaProd",
130
+ tags: ["salon", "vip"],
131
+ });
132
+ const retagged = await agentConfigsActor.setAgentTagsAsyncUnsafe("kasia", [
133
+ "vip",
134
+ ]);
135
+ const mine = (await agentConfigsActor.listAgentConfigsAsyncUnsafe(500)).filter(
136
+ (c) => c.village === "Development",
137
+ );
138
+ ```
139
+
140
+ Village: 1–50 chars, letters, digits, `-` and `_`, starting with a letter or
141
+ digit. Tag: 1–30 chars, lowercase letters, digits and `-`, starting with a
142
+ letter or digit; at most 20 per agent, no duplicates — `InvalidData` otherwise.
143
+
93
144
  ## Error model
94
145
 
95
146
  Every `...AsyncUnsafe` method throws one of exactly three errors — switch on
@@ -105,13 +156,15 @@ Every `...AsyncUnsafe` method throws one of exactly three errors — switch on
105
156
 
106
157
  ## API
107
158
 
108
- - `AgentConfigsActor` — `upsertAgentConfigAsyncUnsafe`, `getAgentConfigAsyncUnsafe`,
109
- `listAgentConfigsAsyncUnsafe`, `deleteAgentConfigAsyncUnsafe`.
159
+ - `AgentConfigsActor` — `upsertAgentConfigAsyncUnsafe`, `setAgentPersonaAsyncUnsafe`,
160
+ `setAgentTagsAsyncUnsafe`, `getAgentConfigAsyncUnsafe`, `listAgentConfigsAsyncUnsafe`,
161
+ `deleteAgentConfigAsyncUnsafe`.
110
162
  - `ChatHistoryActor` — `appendMessageBatchAsyncUnsafe`, `getConversationHistoryAsyncUnsafe`.
111
163
  - `AdminActor` — admin allowlist and diagnostics: `registerAsAdminAsyncUnsafe`,
112
164
  `addAdminAsyncUnsafe`, `removeAdminAsyncUnsafe`, `getAdminsAsyncUnsafe`,
113
165
  `setLoggingEnabledAsyncUnsafe`, `whoAmIAsyncUnsafe`, `getLogsAsyncUnsafe`,
114
- `clearLogsAsyncUnsafe`.
166
+ `clearLogsAsyncUnsafe`, `setConfigChangeNotificationsAsyncUnsafe`,
167
+ `getConfigChangeNotificationsAsyncUnsafe` (`ConfigChangeNotificationsSettings | null`).
115
168
  - Configs/messages are returned as `AgentConfigView`/`ChatMessageView` (opts
116
169
  flattened to optionals, the message role variant as a
117
170
  `"user" | "assistant" | "tool"` string union); raw candid types remain
@@ -120,8 +173,29 @@ Every `...AsyncUnsafe` method throws one of exactly three errors — switch on
120
173
  ## Development
121
174
 
122
175
  See `CLAUDE.md` for the canister-change workflow (declarations sync, wrapper
123
- updates) and the integration-test policy (`npm run test-suite` runs against a
124
- real mainnet test canister — human-run only).
176
+ updates). The scripts below deploy to mainnet and spend cycles — the user runs
177
+ them; Claude never does.
178
+
179
+ - `npm run test-suite` — reinstalls the current canister build into `short-living`,
180
+ the short-lived test canister of `motoko-crafting-table`, with a 3-minute
181
+ lease (no prompt), then runs `tests/test-suite.ts` with `CANISTER_ID` set to
182
+ `short-living`. No `.env`: every identity is generated per run. Tests never touch `backend5`.
183
+ - `npm run test-smoke` — the same, with `tests/test-smoke.ts`: one write and one
184
+ read per domain (~20 seconds). `publish-public` runs it too.
185
+ - `npm run redeploy -- [slot] [reinstall|upgrade] [--force] [--wipe]` — deploys
186
+ the canister build without tests through `../agent-platform-canister`'s
187
+ `craft:upgrade`/`craft:deploy`. Defaults: slot `backend5` (the live agents of
188
+ agents-village), mode **upgrade** (state kept). A reinstall of any slot but
189
+ `short-living` needs `--wipe` and prints the restore steps (`registerAsAdmin`,
190
+ `addAdmin` the village, `addApp` Sultana core, `setConfigChangeNotifications`).
191
+ - `npm run publish-public` — bump the version by hand (uncommitted), then run it
192
+ from `master`. It checks both repos are on a clean `master` equal to
193
+ `origin/master` and the version is unpublished, reinstalls the canister master
194
+ into `short-living` (lease 2 minutes) and refuses unless the candid `short-living` serves
195
+ equals the committed `declarations/` and the smoke test passes against that
196
+ deploy. Then it stamps the canister commit
197
+ into `package.json`, builds, publishes and commits "Version bump to
198
+ <version>".
125
199
 
126
200
  ## Requirements
127
201
 
@@ -6,43 +6,58 @@ type UpsertAgentConfigArgs =
6
6
  name: text;
7
7
  owner: opt principal;
8
8
  persona: text;
9
+ tags: opt vec text;
9
10
  tools: vec ToolBinding;
11
+ village: opt text;
10
12
  };
11
13
  type ToolBinding =
12
14
  record {
13
15
  paramsJson: text;
14
16
  tool: text;
15
17
  };
18
+ type SetConfigChangeNotificationsArgs = record {
19
+ settings:
20
+ opt ConfigChangeNotifications;};
21
+ type SetAgentTagsArgs =
22
+ record {
23
+ agentId: AgentId;
24
+ tags: vec text;
25
+ };
16
26
  type SetAgentPersonaArgs =
17
27
  record {
18
28
  agentId: AgentId;
19
29
  persona: text;
20
30
  };
21
- type Result_6 =
31
+ type Result_7 =
22
32
  variant {
23
33
  err: Error;
24
34
  ok;
25
35
  };
26
- type Result_5 =
36
+ type Result_6 =
27
37
  variant {
28
38
  err: Error;
29
39
  ok: vec principal;
30
40
  };
31
- type Result_4 =
41
+ type Result_5 =
32
42
  variant {
33
43
  err: Error;
34
44
  ok: vec ChatMessage;
35
45
  };
36
- type Result_3 =
46
+ type Result_4 =
37
47
  variant {
38
48
  err: Error;
39
49
  ok: vec AgentConfigView;
40
50
  };
41
- type Result_2 =
51
+ type Result_3 =
42
52
  variant {
43
53
  err: Error;
44
54
  ok: principal;
45
55
  };
56
+ type Result_2 =
57
+ variant {
58
+ err: Error;
59
+ ok: opt ConfigChangeNotifications;
60
+ };
46
61
  type Result_1 =
47
62
  variant {
48
63
  err: Error;
@@ -80,6 +95,11 @@ type Error =
80
95
  logsJson: text;
81
96
  };
82
97
  type ConversationId = text;
98
+ type ConfigChangeNotifications =
99
+ record {
100
+ channel: text;
101
+ rabbitCanisterId: principal;
102
+ };
83
103
  type ChatMessageRole =
84
104
  variant {
85
105
  assistant;
@@ -107,29 +127,37 @@ type AgentConfigView =
107
127
  name: text;
108
128
  owner: opt principal;
109
129
  persona: text;
130
+ tags: vec text;
110
131
  tools: vec ToolBinding;
111
132
  updatedAt: int;
133
+ village: text;
112
134
  };
113
135
  service : {
114
136
  addAdmin: ("principal": principal) -> (Result_1);
115
137
  /// Trusts another app's canister with agents of its own (Sultana's core). Admin only.
116
138
  addApp: (args: AppArgs) -> (Result_1);
117
- appendMessageBatch: (args: AppendMessageBatchArgs) -> (Result_6);
139
+ appendMessageBatch: (args: AppendMessageBatchArgs) -> (Result_7);
118
140
  clearLogs: () -> ();
119
- deleteAgentConfig: (id: AgentId) -> (Result_6);
120
- getAdmins: () -> (Result_5) query;
141
+ deleteAgentConfig: (id: AgentId) -> (Result_7);
142
+ getAdmins: () -> (Result_6) query;
121
143
  getAgentConfig: (id: AgentId) -> (Result) query;
122
- getApps: () -> (Result_5) query;
144
+ getApps: () -> (Result_6) query;
145
+ getConfigChangeNotifications: () -> (Result_2) query;
123
146
  getConversationHistory: (args: GetConversationHistoryArgs) ->
124
- (Result_4) query;
147
+ (Result_5) query;
125
148
  getLogs: () -> (text) query;
126
- listAgentConfigs: (limit: nat) -> (Result_3) query;
127
- registerAsAdmin: () -> (Result_2);
149
+ listAgentConfigs: (limit: nat) -> (Result_4) query;
150
+ registerAsAdmin: () -> (Result_3);
128
151
  removeAdmin: ("principal": principal) -> (Result_1);
129
152
  removeApp: (args: AppArgs) -> (Result_1);
130
153
  /// The one field an agent's owner may change — the salon owner editing what their
131
154
  /// receptionist says. Admins and the creating app may use it too.
132
155
  setAgentPersona: (args: SetAgentPersonaArgs) -> (Result);
156
+ /// Replaces the tags an agent wears. Admins and the app that created the agent.
157
+ setAgentTags: (args: SetAgentTagsArgs) -> (Result);
158
+ /// Where agent configuration changes are reported; null switches the reports off. Admin only.
159
+ setConfigChangeNotifications: (args: SetConfigChangeNotificationsArgs) ->
160
+ (Result_2);
133
161
  setLoggingEnabled: (enabled: bool) -> (Result_1);
134
162
  upsertAgentConfig: (args: UpsertAgentConfigArgs) -> (Result);
135
163
  whoAmI: () -> (principal) query;
@@ -9,8 +9,10 @@ export interface AgentConfigView {
9
9
  'name' : string,
10
10
  'createdAt' : bigint,
11
11
  'createdBy' : [] | [Principal],
12
+ 'tags' : Array<string>,
12
13
  'updatedAt' : bigint,
13
14
  'persona' : string,
15
+ 'village' : string,
14
16
  'disclosesAsAi' : boolean,
15
17
  'customConfigJson' : [] | [string],
16
18
  }
@@ -27,6 +29,10 @@ export interface ChatMessage {
27
29
  export type ChatMessageRole = { 'tool' : null } |
28
30
  { 'user' : null } |
29
31
  { 'assistant' : null };
32
+ export interface ConfigChangeNotifications {
33
+ 'rabbitCanisterId' : Principal,
34
+ 'channel' : string,
35
+ }
30
36
  export type ConversationId = string;
31
37
  export interface Error { 'details' : ErrorDetails, 'logsJson' : string }
32
38
  export type ErrorDetails = { 'InterCanisterConnectionError' : null } |
@@ -49,24 +55,35 @@ export type Result = { 'ok' : AgentConfigView } |
49
55
  { 'err' : Error };
50
56
  export type Result_1 = { 'ok' : boolean } |
51
57
  { 'err' : Error };
52
- export type Result_2 = { 'ok' : Principal } |
58
+ export type Result_2 = { 'ok' : [] | [ConfigChangeNotifications] } |
59
+ { 'err' : Error };
60
+ export type Result_3 = { 'ok' : Principal } |
53
61
  { 'err' : Error };
54
- export type Result_3 = { 'ok' : Array<AgentConfigView> } |
62
+ export type Result_4 = { 'ok' : Array<AgentConfigView> } |
55
63
  { 'err' : Error };
56
- export type Result_4 = { 'ok' : Array<ChatMessage> } |
64
+ export type Result_5 = { 'ok' : Array<ChatMessage> } |
57
65
  { 'err' : Error };
58
- export type Result_5 = { 'ok' : Array<Principal> } |
66
+ export type Result_6 = { 'ok' : Array<Principal> } |
59
67
  { 'err' : Error };
60
- export type Result_6 = { 'ok' : null } |
68
+ export type Result_7 = { 'ok' : null } |
61
69
  { 'err' : Error };
62
70
  export interface SetAgentPersonaArgs { 'agentId' : AgentId, 'persona' : string }
71
+ export interface SetAgentTagsArgs {
72
+ 'tags' : Array<string>,
73
+ 'agentId' : AgentId,
74
+ }
75
+ export interface SetConfigChangeNotificationsArgs {
76
+ 'settings' : [] | [ConfigChangeNotifications],
77
+ }
63
78
  export interface ToolBinding { 'paramsJson' : string, 'tool' : string }
64
79
  export interface UpsertAgentConfigArgs {
65
80
  'id' : AgentId,
66
81
  'tools' : Array<ToolBinding>,
67
82
  'owner' : [] | [Principal],
68
83
  'name' : string,
84
+ 'tags' : [] | [Array<string>],
69
85
  'persona' : string,
86
+ 'village' : [] | [string],
70
87
  'disclosesAsAi' : boolean,
71
88
  'customConfigJson' : [] | [string],
72
89
  }
@@ -76,19 +93,20 @@ export interface _SERVICE {
76
93
  * / Trusts another app's canister with agents of its own (Sultana's core). Admin only.
77
94
  */
78
95
  'addApp' : ActorMethod<[AppArgs], Result_1>,
79
- 'appendMessageBatch' : ActorMethod<[AppendMessageBatchArgs], Result_6>,
96
+ 'appendMessageBatch' : ActorMethod<[AppendMessageBatchArgs], Result_7>,
80
97
  'clearLogs' : ActorMethod<[], undefined>,
81
- 'deleteAgentConfig' : ActorMethod<[AgentId], Result_6>,
82
- 'getAdmins' : ActorMethod<[], Result_5>,
98
+ 'deleteAgentConfig' : ActorMethod<[AgentId], Result_7>,
99
+ 'getAdmins' : ActorMethod<[], Result_6>,
83
100
  'getAgentConfig' : ActorMethod<[AgentId], Result>,
84
- 'getApps' : ActorMethod<[], Result_5>,
101
+ 'getApps' : ActorMethod<[], Result_6>,
102
+ 'getConfigChangeNotifications' : ActorMethod<[], Result_2>,
85
103
  'getConversationHistory' : ActorMethod<
86
104
  [GetConversationHistoryArgs],
87
- Result_4
105
+ Result_5
88
106
  >,
89
107
  'getLogs' : ActorMethod<[], string>,
90
- 'listAgentConfigs' : ActorMethod<[bigint], Result_3>,
91
- 'registerAsAdmin' : ActorMethod<[], Result_2>,
108
+ 'listAgentConfigs' : ActorMethod<[bigint], Result_4>,
109
+ 'registerAsAdmin' : ActorMethod<[], Result_3>,
92
110
  'removeAdmin' : ActorMethod<[Principal], Result_1>,
93
111
  'removeApp' : ActorMethod<[AppArgs], Result_1>,
94
112
  /**
@@ -96,6 +114,17 @@ export interface _SERVICE {
96
114
  * / receptionist says. Admins and the creating app may use it too.
97
115
  */
98
116
  'setAgentPersona' : ActorMethod<[SetAgentPersonaArgs], Result>,
117
+ /**
118
+ * / Replaces the tags an agent wears. Admins and the app that created the agent.
119
+ */
120
+ 'setAgentTags' : ActorMethod<[SetAgentTagsArgs], Result>,
121
+ /**
122
+ * / Where agent configuration changes are reported; null switches the reports off. Admin only.
123
+ */
124
+ 'setConfigChangeNotifications' : ActorMethod<
125
+ [SetConfigChangeNotificationsArgs],
126
+ Result_2
127
+ >,
99
128
  'setLoggingEnabled' : ActorMethod<[boolean], Result_1>,
100
129
  'upsertAgentConfig' : ActorMethod<[UpsertAgentConfigArgs], Result>,
101
130
  'whoAmI' : ActorMethod<[], Principal>,
@@ -33,8 +33,8 @@ export const idlFactory = ({ IDL }) => {
33
33
  const AppendMessageBatchArgs = IDL.Record({
34
34
  'entries' : IDL.Vec(MessageBatchEntry),
35
35
  });
36
- const Result_6 = IDL.Variant({ 'ok' : IDL.Null, 'err' : Error });
37
- const Result_5 = IDL.Variant({
36
+ const Result_7 = IDL.Variant({ 'ok' : IDL.Null, 'err' : Error });
37
+ const Result_6 = IDL.Variant({
38
38
  'ok' : IDL.Vec(IDL.Principal),
39
39
  'err' : Error,
40
40
  });
@@ -49,55 +49,81 @@ export const idlFactory = ({ IDL }) => {
49
49
  'name' : IDL.Text,
50
50
  'createdAt' : IDL.Int,
51
51
  'createdBy' : IDL.Opt(IDL.Principal),
52
+ 'tags' : IDL.Vec(IDL.Text),
52
53
  'updatedAt' : IDL.Int,
53
54
  'persona' : IDL.Text,
55
+ 'village' : IDL.Text,
54
56
  'disclosesAsAi' : IDL.Bool,
55
57
  'customConfigJson' : IDL.Opt(IDL.Text),
56
58
  });
57
59
  const Result = IDL.Variant({ 'ok' : AgentConfigView, 'err' : Error });
60
+ const ConfigChangeNotifications = IDL.Record({
61
+ 'rabbitCanisterId' : IDL.Principal,
62
+ 'channel' : IDL.Text,
63
+ });
64
+ const Result_2 = IDL.Variant({
65
+ 'ok' : IDL.Opt(ConfigChangeNotifications),
66
+ 'err' : Error,
67
+ });
58
68
  const GetConversationHistoryArgs = IDL.Record({
59
69
  'limit' : IDL.Nat,
60
70
  'conversationId' : ConversationId,
61
71
  });
62
- const Result_4 = IDL.Variant({ 'ok' : IDL.Vec(ChatMessage), 'err' : Error });
63
- const Result_3 = IDL.Variant({
72
+ const Result_5 = IDL.Variant({ 'ok' : IDL.Vec(ChatMessage), 'err' : Error });
73
+ const Result_4 = IDL.Variant({
64
74
  'ok' : IDL.Vec(AgentConfigView),
65
75
  'err' : Error,
66
76
  });
67
- const Result_2 = IDL.Variant({ 'ok' : IDL.Principal, 'err' : Error });
77
+ const Result_3 = IDL.Variant({ 'ok' : IDL.Principal, 'err' : Error });
68
78
  const SetAgentPersonaArgs = IDL.Record({
69
79
  'agentId' : AgentId,
70
80
  'persona' : IDL.Text,
71
81
  });
82
+ const SetAgentTagsArgs = IDL.Record({
83
+ 'tags' : IDL.Vec(IDL.Text),
84
+ 'agentId' : AgentId,
85
+ });
86
+ const SetConfigChangeNotificationsArgs = IDL.Record({
87
+ 'settings' : IDL.Opt(ConfigChangeNotifications),
88
+ });
72
89
  const UpsertAgentConfigArgs = IDL.Record({
73
90
  'id' : AgentId,
74
91
  'tools' : IDL.Vec(ToolBinding),
75
92
  'owner' : IDL.Opt(IDL.Principal),
76
93
  'name' : IDL.Text,
94
+ 'tags' : IDL.Opt(IDL.Vec(IDL.Text)),
77
95
  'persona' : IDL.Text,
96
+ 'village' : IDL.Opt(IDL.Text),
78
97
  'disclosesAsAi' : IDL.Bool,
79
98
  'customConfigJson' : IDL.Opt(IDL.Text),
80
99
  });
81
100
  return IDL.Service({
82
101
  'addAdmin' : IDL.Func([IDL.Principal], [Result_1], []),
83
102
  'addApp' : IDL.Func([AppArgs], [Result_1], []),
84
- 'appendMessageBatch' : IDL.Func([AppendMessageBatchArgs], [Result_6], []),
103
+ 'appendMessageBatch' : IDL.Func([AppendMessageBatchArgs], [Result_7], []),
85
104
  'clearLogs' : IDL.Func([], [], []),
86
- 'deleteAgentConfig' : IDL.Func([AgentId], [Result_6], []),
87
- 'getAdmins' : IDL.Func([], [Result_5], ['query']),
105
+ 'deleteAgentConfig' : IDL.Func([AgentId], [Result_7], []),
106
+ 'getAdmins' : IDL.Func([], [Result_6], ['query']),
88
107
  'getAgentConfig' : IDL.Func([AgentId], [Result], ['query']),
89
- 'getApps' : IDL.Func([], [Result_5], ['query']),
108
+ 'getApps' : IDL.Func([], [Result_6], ['query']),
109
+ 'getConfigChangeNotifications' : IDL.Func([], [Result_2], ['query']),
90
110
  'getConversationHistory' : IDL.Func(
91
111
  [GetConversationHistoryArgs],
92
- [Result_4],
112
+ [Result_5],
93
113
  ['query'],
94
114
  ),
95
115
  'getLogs' : IDL.Func([], [IDL.Text], ['query']),
96
- 'listAgentConfigs' : IDL.Func([IDL.Nat], [Result_3], ['query']),
97
- 'registerAsAdmin' : IDL.Func([], [Result_2], []),
116
+ 'listAgentConfigs' : IDL.Func([IDL.Nat], [Result_4], ['query']),
117
+ 'registerAsAdmin' : IDL.Func([], [Result_3], []),
98
118
  'removeAdmin' : IDL.Func([IDL.Principal], [Result_1], []),
99
119
  'removeApp' : IDL.Func([AppArgs], [Result_1], []),
100
120
  'setAgentPersona' : IDL.Func([SetAgentPersonaArgs], [Result], []),
121
+ 'setAgentTags' : IDL.Func([SetAgentTagsArgs], [Result], []),
122
+ 'setConfigChangeNotifications' : IDL.Func(
123
+ [SetConfigChangeNotificationsArgs],
124
+ [Result_2],
125
+ [],
126
+ ),
101
127
  'setLoggingEnabled' : IDL.Func([IDL.Bool], [Result_1], []),
102
128
  'upsertAgentConfig' : IDL.Func([UpsertAgentConfigArgs], [Result], []),
103
129
  'whoAmI' : IDL.Func([], [IDL.Principal], ['query']),
@@ -1,5 +1,6 @@
1
1
  import { type Identity } from "@icp-sdk/core/agent";
2
2
  import { ActorBase, type LogEntry } from "../actor-base.js";
3
+ import type { ConfigChangeNotificationsSettings } from "../interfaces.js";
3
4
  /** 1:1 wrapper for the canister's AdminController plus the diagnostic endpoints
4
5
  * (whoAmI, getLogs, clearLogs). */
5
6
  export declare class AdminActor extends ActorBase {
@@ -96,5 +97,27 @@ export declare class AdminActor extends ActorBase {
96
97
  * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
97
98
  */
98
99
  getAppsAsyncUnsafe(): Promise<string[]>;
100
+ /**
101
+ * Points the canister's agent configuration change reports at a rabbit-motoko channel,
102
+ * or switches them off with `null`. Once set, every real create, change or delete of
103
+ * an agent config adds one task there (commonId = the agent id, payload
104
+ * `{"agentId":"<id>","change":"upserted"|"deleted"}`), so agents-village reloads only
105
+ * that agent. The canister must be allowed to add tasks on the channel in rabbit. Admin
106
+ * only.
107
+ * @param settings - The rabbit canister (text form) and channel, or `null` to switch off.
108
+ * @returns The committed settings.
109
+ * @throws Error with message `CanisterError` when the canister returns a business error (not authorized, errorKey `InvalidData` for an anonymous canister or an empty / longer than 100 chars channel). Examine "cause" for {errorKey, errorMessage, logs}.
110
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
111
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
112
+ */
113
+ setConfigChangeNotificationsAsyncUnsafe(settings: ConfigChangeNotificationsSettings | null): Promise<ConfigChangeNotificationsSettings | null>;
114
+ /**
115
+ * Where the canister reports agent configuration changes; `null` when the reports are
116
+ * off. Admin only.
117
+ * @throws Error with message `CanisterError` when the caller is not the admin. Examine "cause" for {errorKey, errorMessage, logs}.
118
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
119
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
120
+ */
121
+ getConfigChangeNotificationsAsyncUnsafe(): Promise<ConfigChangeNotificationsSettings | null>;
99
122
  }
100
123
  //# sourceMappingURL=admin-actor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"admin-actor.d.ts","sourceRoot":"","sources":["../../src/actors/admin-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,kB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SON } from "@jsm-mit/utils-package";
4
4
  import { ActorBase } from "../actor-base.js";
5
+ import { mapConfigChangeNotificationsSettings } from "../mappers.js";
5
6
  /** 1:1 wrapper for the canister's AdminController plus the diagnostic endpoints
6
7
  * (whoAmI, getLogs, clearLogs). */
7
8
  export class AdminActor extends ActorBase {
@@ -127,4 +128,41 @@ export class AdminActor extends ActorBase {
127
128
  const apps = await this.executeFunctionAsyncUnsafe(() => this.actor.getApps());
128
129
  return apps.map((principal) => principal.toString());
129
130
  }
131
+ /**
132
+ * Points the canister's agent configuration change reports at a rabbit-motoko channel,
133
+ * or switches them off with `null`. Once set, every real create, change or delete of
134
+ * an agent config adds one task there (commonId = the agent id, payload
135
+ * `{"agentId":"<id>","change":"upserted"|"deleted"}`), so agents-village reloads only
136
+ * that agent. The canister must be allowed to add tasks on the channel in rabbit. Admin
137
+ * only.
138
+ * @param settings - The rabbit canister (text form) and channel, or `null` to switch off.
139
+ * @returns The committed settings.
140
+ * @throws Error with message `CanisterError` when the canister returns a business error (not authorized, errorKey `InvalidData` for an anonymous canister or an empty / longer than 100 chars channel). Examine "cause" for {errorKey, errorMessage, logs}.
141
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
142
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
143
+ */
144
+ async setConfigChangeNotificationsAsyncUnsafe(settings) {
145
+ const committed = await this.executeFunctionAsyncUnsafe(() => this.actor.setConfigChangeNotifications({
146
+ settings: settings === null
147
+ ? []
148
+ : [
149
+ {
150
+ rabbitCanisterId: Principal.fromText(settings.rabbitCanisterId),
151
+ channel: settings.channel,
152
+ },
153
+ ],
154
+ }));
155
+ return mapConfigChangeNotificationsSettings(committed);
156
+ }
157
+ /**
158
+ * Where the canister reports agent configuration changes; `null` when the reports are
159
+ * off. Admin only.
160
+ * @throws Error with message `CanisterError` when the caller is not the admin. Examine "cause" for {errorKey, errorMessage, logs}.
161
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
162
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
163
+ */
164
+ async getConfigChangeNotificationsAsyncUnsafe() {
165
+ const settings = await this.executeFunctionAsyncUnsafe(() => this.actor.getConfigChangeNotifications());
166
+ return mapConfigChangeNotificationsSettings(settings);
167
+ }
130
168
  }
@@ -6,15 +6,31 @@ export declare class AgentConfigsActor extends ActorBase {
6
6
  constructor(canisterId: string, identity?: Identity);
7
7
  /**
8
8
  * Creates the config on first write, otherwise updates it in place —
9
- * `createdAt` is preserved across an update. Admin only.
9
+ * `createdAt` is preserved across an update. Admins and registered apps create;
10
+ * an update belongs to the creating app or an admin.
10
11
  * @param input - The full desired config; `id` decides create-vs-update. `tools`
11
- * defaults to [] (a tool-less agent) when omitted.
12
+ * defaults to [] (a tool-less agent) when omitted. `village` and `tags` left out keep
13
+ * what is stored (the defaults on a create).
12
14
  * @returns The stored config as it now stands.
13
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}.
14
16
  * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
15
17
  * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
16
18
  */
17
19
  upsertAgentConfigAsyncUnsafe(input: UpsertAgentConfigInput): Promise<AgentConfigView>;
20
+ /**
21
+ * Replaces every tag the agent wears. Tags decide nothing about how the agent runs —
22
+ * the dashboard filters by them — but a different set moves `updatedAt` and is
23
+ * reported to config-change listeners like any other change; the same set again
24
+ * changes nothing.
25
+ *
26
+ * Allowed for the app that created the agent and canister admins.
27
+ * @param tags - Each 1–30 chars, lowercase letters, digits and `-`, starting with a
28
+ * letter or digit; at most 20, no duplicates.
29
+ * @throws Error with message `CanisterError` when the canister returns a business error (`NotAuthorized` for anybody else, `NotFound`, `InvalidData` for a malformed tag, a duplicate or too many). Examine "cause" for {errorKey, errorMessage, logs}.
30
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
31
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
32
+ */
33
+ setAgentTagsAsyncUnsafe(agentId: string, tags: string[]): Promise<AgentConfigView>;
18
34
  /**
19
35
  * Changes what the agent says it is — the one field its owner may touch. A full
20
36
  * upsert belongs to the app that created the agent, because it would also re-point
@@ -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;AAE7C,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;IAe3B;;;;;;;;;OASG;IACU,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAOnG;;;;;;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;AAE7C,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;;;;;;;;;;;OAWG;IACU,4BAA4B,CACrC,KAAK,EAAE,sBAAsB,GAC9B,OAAO,CAAC,eAAe,CAAC;IAmB3B;;;;;;;;;;;;OAYG;IACU,uBAAuB,CAChC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,GACf,OAAO,CAAC,eAAe,CAAC;IAO3B;;;;;;;;;OASG;IACU,0BAA0B,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAChB,OAAO,CAAC,eAAe,CAAC;IAO3B;;;;;;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"}
@@ -9,9 +9,11 @@ export class AgentConfigsActor extends ActorBase {
9
9
  }
10
10
  /**
11
11
  * Creates the config on first write, otherwise updates it in place —
12
- * `createdAt` is preserved across an update. Admin only.
12
+ * `createdAt` is preserved across an update. Admins and registered apps create;
13
+ * an update belongs to the creating app or an admin.
13
14
  * @param input - The full desired config; `id` decides create-vs-update. `tools`
14
- * defaults to [] (a tool-less agent) when omitted.
15
+ * defaults to [] (a tool-less agent) when omitted. `village` and `tags` left out keep
16
+ * what is stored (the defaults on a create).
15
17
  * @returns The stored config as it now stands.
16
18
  * @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
19
  * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
@@ -26,9 +28,28 @@ export class AgentConfigsActor extends ActorBase {
26
28
  tools: input.tools ?? [],
27
29
  customConfigJson: toOpt(input.customConfigJson),
28
30
  owner: toOpt(input.owner ? Principal.fromText(input.owner) : undefined),
31
+ village: toOpt(input.village),
32
+ tags: toOpt(input.tags),
29
33
  }));
30
34
  return mapAgentConfigView(config);
31
35
  }
36
+ /**
37
+ * Replaces every tag the agent wears. Tags decide nothing about how the agent runs —
38
+ * the dashboard filters by them — but a different set moves `updatedAt` and is
39
+ * reported to config-change listeners like any other change; the same set again
40
+ * changes nothing.
41
+ *
42
+ * Allowed for the app that created the agent and canister admins.
43
+ * @param tags - Each 1–30 chars, lowercase letters, digits and `-`, starting with a
44
+ * letter or digit; at most 20, no duplicates.
45
+ * @throws Error with message `CanisterError` when the canister returns a business error (`NotAuthorized` for anybody else, `NotFound`, `InvalidData` for a malformed tag, a duplicate or too many). Examine "cause" for {errorKey, errorMessage, logs}.
46
+ * @throws Error with message `CriticalCanisterError` when there is no communication with the canister or the canister code traps during execution.
47
+ * @throws Error with message `CallRefusedAtInspectionStage` when the canister's `inspect` rejects the call before execution.
48
+ */
49
+ async setAgentTagsAsyncUnsafe(agentId, tags) {
50
+ const config = await this.executeFunctionAsyncUnsafe(() => this.actor.setAgentTags({ agentId, tags }));
51
+ return mapAgentConfigView(config);
52
+ }
32
53
  /**
33
54
  * Changes what the agent says it is — the one field its owner may touch. A full
34
55
  * upsert belongs to the app that created the agent, because it would also re-point
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { ActorBase, type LogEntry } from "./actor-base.js";
2
2
  export { AdminActor } from "./actors/admin-actor.js";
3
3
  export { AgentConfigsActor } from "./actors/agent-configs-actor.js";
4
4
  export { ChatHistoryActor } from "./actors/chat-history-actor.js";
5
- export type { ChatMessageRoleView, ChatMessageView, MessageBatchEntryInput, AgentConfigView, UpsertAgentConfigInput, } from "./interfaces.js";
6
- export { mapChatMessageRoleView, mapChatMessageView, mapAgentConfigView, } from "./mappers.js";
5
+ export type { ChatMessageRoleView, ChatMessageView, MessageBatchEntryInput, AgentConfigView, UpsertAgentConfigInput, ConfigChangeNotificationsSettings, } from "./interfaces.js";
6
+ export { mapChatMessageRoleView, mapChatMessageView, mapAgentConfigView, mapConfigChangeNotificationsSettings, } from "./mappers.js";
7
7
  export type { ToolBinding, Error as CanisterErrorShape, ErrorDetails, } from "../declarations/agent-platform-canister/agent-platform-canister.did.js";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,YAAY,EACR,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,sBAAsB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,GACrB,MAAM,cAAc,CAAC;AACtB,YAAY,EACR,WAAW,EACX,KAAK,IAAI,kBAAkB,EAC3B,YAAY,GACf,MAAM,wEAAwE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,YAAY,EACR,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,iCAAiC,GACpC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,oCAAoC,GACvC,MAAM,cAAc,CAAC;AACtB,YAAY,EACR,WAAW,EACX,KAAK,IAAI,kBAAkB,EAC3B,YAAY,GACf,MAAM,wEAAwE,CAAC"}
package/dist/index.js CHANGED
@@ -2,4 +2,4 @@ export { ActorBase } from "./actor-base.js";
2
2
  export { AdminActor } from "./actors/admin-actor.js";
3
3
  export { AgentConfigsActor } from "./actors/agent-configs-actor.js";
4
4
  export { ChatHistoryActor } from "./actors/chat-history-actor.js";
5
- export { mapChatMessageRoleView, mapChatMessageView, mapAgentConfigView, } from "./mappers.js";
5
+ export { mapChatMessageRoleView, mapChatMessageView, mapAgentConfigView, mapConfigChangeNotificationsSettings, } from "./mappers.js";
@@ -45,11 +45,28 @@ export interface AgentConfigView {
45
45
  createdBy?: string;
46
46
  /** The person allowed to change the agent's words (and nothing else). */
47
47
  owner?: string;
48
+ /** The agents-village process that runs this agent — "Development" unless it was
49
+ * placed elsewhere (a second village, e.g. Sultana's production, shares the canister
50
+ * and runs only what is placed in it). */
51
+ village: string;
52
+ /** Labels the dashboard filters by; the canister attaches no meaning to them. Empty
53
+ * unless set. */
54
+ tags: string[];
48
55
  /** Nanoseconds since epoch */
49
56
  createdAt: bigint;
50
57
  /** Nanoseconds since epoch */
51
58
  updatedAt: bigint;
52
59
  }
60
+ /** Where the canister reports agent configuration changes: a task on this rabbit-motoko
61
+ * canister's channel for every real create, change or delete of an agent config
62
+ * (commonId = the agent id, payload `{"agentId":"<id>","change":"upserted"|"deleted"}`).
63
+ * Candid `opt ConfigChangeNotifications` with the principal as text; `null` = reports off. */
64
+ export interface ConfigChangeNotificationsSettings {
65
+ /** The rabbit-motoko canister (text form). The agent-platform canister must be allowed
66
+ * to add tasks on the channel there. */
67
+ rabbitCanisterId: string;
68
+ channel: string;
69
+ }
53
70
  /** Input for AgentConfigsActor.upsertAgentConfigAsyncUnsafe — customConfigJson as a
54
71
  * plain optional (candid `opt` shaping done by the wrapper); tools is optional here
55
72
  * even though the canister's own UpsertAgentConfigArgs requires it — the wrapper
@@ -67,5 +84,14 @@ export interface UpsertAgentConfigInput {
67
84
  customConfigJson?: string;
68
85
  /** Read only when the agent is CREATED: the person who may change its words later. */
69
86
  owner?: string;
87
+ /** The village that runs the agent. Omitted: the stored village stays on an update,
88
+ * a create lands in "Development" — a caller that never heard of villages cannot
89
+ * move an agent. 1–50 chars, letters, digits, `-` and `_`, starting with a letter
90
+ * or digit. */
91
+ village?: string;
92
+ /** Omitted: the stored tags stay on an update, a create gets none. Each 1–30 chars,
93
+ * lowercase letters, digits and `-`, starting with a letter or digit; at most 20,
94
+ * no duplicates. */
95
+ tags?: string[];
70
96
  }
71
97
  //# 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;;+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,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QACL,IAAI,EAAE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AACvC,MAAM,WAAW,sBAAsB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;mBAGe;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;wBAEoB;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB"}
package/dist/mappers.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import type { AgentConfigView as CandidAgentConfig, ChatMessage, ChatMessageRole } from "../declarations/agent-platform-canister/agent-platform-canister.did.js";
2
- import type { ChatMessageRoleView, ChatMessageView, AgentConfigView } from "./interfaces.js";
1
+ import type { AgentConfigView as CandidAgentConfig, ChatMessage, ChatMessageRole, ConfigChangeNotifications as CandidConfigChangeNotifications } from "../declarations/agent-platform-canister/agent-platform-canister.did.js";
2
+ import type { ChatMessageRoleView, ChatMessageView, AgentConfigView, ConfigChangeNotificationsSettings } 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
7
  export declare function mapAgentConfigView(config: CandidAgentConfig): AgentConfigView;
8
+ export declare function mapConfigChangeNotificationsSettings(settings: [] | [CandidConfigChangeNotifications]): ConfigChangeNotificationsSettings | null;
8
9
  export { toOpt };
9
10
  //# 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,eAAe,IAAI,iBAAiB,EACpC,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,iBAAiB,GAAG,eAAe,CAa7E;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,eAAe,IAAI,iBAAiB,EACpC,WAAW,EACX,eAAe,EACf,yBAAyB,IAAI,+BAA+B,EAC/D,MAAM,wEAAwE,CAAC;AAChF,OAAO,KAAK,EACR,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,iCAAiC,EACpC,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,iBAAiB,GAAG,eAAe,CAe7E;AAED,wBAAgB,oCAAoC,CAChD,QAAQ,EAAE,EAAE,GAAG,CAAC,+BAA+B,CAAC,GACjD,iCAAiC,GAAG,IAAI,CAQ1C;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
package/dist/mappers.js CHANGED
@@ -29,8 +29,19 @@ export function mapAgentConfigView(config) {
29
29
  customConfigJson: fromOpt(config.customConfigJson),
30
30
  createdBy: fromOpt(config.createdBy)?.toString(),
31
31
  owner: fromOpt(config.owner)?.toString(),
32
+ village: config.village,
33
+ tags: config.tags,
32
34
  createdAt: config.createdAt,
33
35
  updatedAt: config.updatedAt,
34
36
  };
35
37
  }
38
+ export function mapConfigChangeNotificationsSettings(settings) {
39
+ const value = fromOpt(settings);
40
+ if (value === undefined)
41
+ return null;
42
+ return {
43
+ rabbitCanisterId: value.rabbitCanisterId.toText(),
44
+ channel: value.channel,
45
+ };
46
+ }
36
47
  export { toOpt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsm-mit/agent-platform-canister-package",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Wrapper TypeScript package for the agent-platform-canister canister.",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -25,7 +25,9 @@
25
25
  "publish-public": "bash scripts/publish-public.sh",
26
26
  "typecheck": "tsc --noEmit -p tsconfig.tests.json",
27
27
  "sync-declarations": "bash scripts/sync-declarations.sh",
28
- "test-suite": "bash scripts/run-tests.sh tests/test-suite.ts",
28
+ "test-suite": "bash scripts/run-tests.sh tests/test-suite.ts --lease 3",
29
+ "test-smoke": "bash scripts/run-tests.sh tests/test-smoke.ts --lease 3",
30
+ "redeploy": "bash scripts/redeploy.sh",
29
31
  "sandbox": "npx tsx sandbox/main.ts",
30
32
  "format": "prettier --write .",
31
33
  "format:check": "prettier --check .",
@@ -49,6 +51,6 @@
49
51
  "agentPlatformCanister": {
50
52
  "repo": "agent-platform-canister",
51
53
  "repoUrl": "https://github.com/JSM-Agent-Platform/agent-platform-canister",
52
- "commit": "2d302e673013d54083babbbb9aa79eb718d7bf74"
54
+ "commit": "2f8d258092707ef4d50f0a2c6bdf557969f3f8a3"
53
55
  }
54
56
  }