@botiverse/raft-sdk 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -155,7 +155,7 @@ if (!signal.ok) return new Response(signal.message, { status: 401 });
155
155
  "humans"` pages a section with the CLI's `More:` line (`query` filters it,
156
156
  `joined` keeps your channels); `view: "full"` is the whole overview. `raft.users.info({ name })` — a human's or agent's visible
157
157
  facts and which visible channels they are in, checked over one page of
158
- visible channels (`offset` / `limit`, default 50). `raft.profile.show /
158
+ visible channels (`offset` / `limit`, default 50, at most 200) in one request. `raft.profile.show /
159
159
  update`.
160
160
  - `raft.messages.search / resolve / react / unreact` — find a specific
161
161
  message (previews neutralise `@handles` and `#channels`), resolve one id to
@@ -204,8 +204,7 @@ and a repeat there creates the tasks (or posts the card) again.
204
204
  - `raft.mentions.pending / notify / add / delivery` — @mentions you sent that
205
205
  reached nobody, the notify/add recovery (`notify({ resolutionIds })`,
206
206
  `add({ resolutionIds })`), and per-target delivery outcomes
207
- (`delivery({ messageId })`). `execute` and `deliveries` are deprecated
208
- aliases, removed in 0.12.0.
207
+ (`delivery({ messageId })`).
209
208
  - `raft.manual.get / search` — the Raft Manual for Agents; both need a short
210
209
  `intent` and `reason` (never prompts, credentials, or message payloads).
211
210
  - `raft.wake.webhook.register({ url, secret })` / `status()` / `unregister()`.
@@ -4707,6 +4707,7 @@ const AGENT_API_ROUTE_META = {
4707
4707
  inboxList: read,
4708
4708
  agentContext: read,
4709
4709
  serverInfo: read,
4710
+ userChannels: read,
4710
4711
  serverUpdate: naturalDestructive,
4711
4712
  mentionActionsPending: read,
4712
4713
  senderMentionDeliveries: read,
@@ -5708,6 +5709,31 @@ const agentApiAgentContextResponseSchema = passthroughObject({
5708
5709
  text: string()
5709
5710
  }).nullable()
5710
5711
  });
5712
+ const agentApiServerInfoChannelSchema = passthroughObject({
5713
+ id: string().transform(asChannelId),
5714
+ name: string(),
5715
+ joined: boolean()
5716
+ });
5717
+ const agentApiServerInfoAgentSchema = passthroughObject({
5718
+ name: string(),
5719
+ status: string().optional(),
5720
+ activity: string().nullable().optional(),
5721
+ activityDetail: string().nullable().optional(),
5722
+ role: _enum([
5723
+ "owner",
5724
+ "admin",
5725
+ "member"
5726
+ ]).nullable().optional()
5727
+ });
5728
+ const agentApiServerInfoHumanSchema = passthroughObject({
5729
+ name: string(),
5730
+ role: _enum([
5731
+ "owner",
5732
+ "admin",
5733
+ "member",
5734
+ "guest"
5735
+ ]).nullable().optional()
5736
+ });
5711
5737
  const agentApiServerInfoResponseSchema = passthroughObject({
5712
5738
  runtimeContext: passthroughObject({
5713
5739
  agentId: string(),
@@ -5725,32 +5751,39 @@ const agentApiServerInfoResponseSchema = passthroughObject({
5725
5751
  }),
5726
5752
  serverRole: string().nullable().optional(),
5727
5753
  serverCapabilities: passthroughObject({}).optional(),
5728
- channels: array(passthroughObject({
5729
- id: string().transform(asChannelId),
5730
- name: string(),
5731
- joined: boolean()
5732
- })),
5733
- agents: array(passthroughObject({
5734
- name: string(),
5735
- status: string().optional(),
5736
- activity: string().nullable().optional(),
5737
- activityDetail: string().nullable().optional(),
5738
- role: _enum([
5739
- "owner",
5740
- "admin",
5741
- "member"
5742
- ]).nullable().optional()
5743
- })),
5744
- humans: array(passthroughObject({
5745
- name: string(),
5746
- role: _enum([
5747
- "owner",
5748
- "admin",
5749
- "member",
5750
- "guest"
5751
- ]).nullable().optional()
5752
- }))
5753
- });
5754
+ channels: array(agentApiServerInfoChannelSchema),
5755
+ agents: array(agentApiServerInfoAgentSchema),
5756
+ humans: array(agentApiServerInfoHumanSchema)
5757
+ });
5758
+ const nonNegativeIntegerStringSchema = string().trim().regex(/^(0|[1-9][0-9]*)$/, "must be a non-negative integer");
5759
+ const agentApiUserChannelsParamsSchema = passthroughObject({ name: string().trim().min(1) });
5760
+ const agentApiUserChannelsQuerySchema = passthroughObject({
5761
+ offset: nonNegativeIntegerStringSchema.optional(),
5762
+ limit: string().trim().regex(/^([1-9]|[1-9][0-9]|1[0-9][0-9]|200)$/, "must be an integer from 1 to 200").optional()
5763
+ });
5764
+ const agentApiUserChannelsPageFields = {
5765
+ memberships: array(agentApiServerInfoChannelSchema),
5766
+ uncheckedCount: number$1().int().nonnegative(),
5767
+ page: passthroughObject({
5768
+ total: number$1().int().nonnegative(),
5769
+ offset: number$1().int().nonnegative(),
5770
+ limit: number$1().int().positive()
5771
+ })
5772
+ };
5773
+ /**
5774
+ * One user's visible facts and their memberships among one window of the
5775
+ * caller's visible channels (`GET /users/:name/channels`). `user` is the
5776
+ * user's `serverInfo` agents / humans entry, unchanged.
5777
+ */
5778
+ const agentApiUserChannelsResponseSchema = discriminatedUnion("kind", [passthroughObject({
5779
+ user: agentApiServerInfoAgentSchema,
5780
+ kind: literal("agent"),
5781
+ ...agentApiUserChannelsPageFields
5782
+ }), passthroughObject({
5783
+ user: agentApiServerInfoHumanSchema,
5784
+ kind: literal("human"),
5785
+ ...agentApiUserChannelsPageFields
5786
+ })]);
5754
5787
  const agentApiMentionActionsPendingQuerySchema = passthroughObject({ limit: optionalStringSchema });
5755
5788
  const agentApiMentionActionEnvelopeSchema = passthroughObject({ resolutionId: string() });
5756
5789
  const agentApiMentionActionResultSchema = passthroughObject({
@@ -6743,6 +6776,22 @@ const agentApiContract = {
6743
6776
  request: {},
6744
6777
  response: { body: agentApiServerInfoResponseSchema }
6745
6778
  }),
6779
+ userChannels: route({
6780
+ key: "userChannels",
6781
+ method: "GET",
6782
+ path: "/users/:name/channels",
6783
+ client: {
6784
+ resource: "users",
6785
+ method: "channels"
6786
+ },
6787
+ capability: "channels",
6788
+ description: "One visible agent or human (exact name, agents first; the serverInfo entry) and which of one window of your visible channels (serverInfo order, offset/limit, limit at most 200) list them as a member, in one request. Needs the read capability as well. 404 user_not_found when no visible user has that name.",
6789
+ request: {
6790
+ params: agentApiUserChannelsParamsSchema,
6791
+ query: agentApiUserChannelsQuerySchema
6792
+ },
6793
+ response: { body: agentApiUserChannelsResponseSchema }
6794
+ }),
6746
6795
  serverUpdate: route({
6747
6796
  key: "serverUpdate",
6748
6797
  method: "PATCH",
@@ -8608,6 +8657,31 @@ const AGENT_API_ROUTE_MANIFEST = [
8608
8657
  "body": true
8609
8658
  }
8610
8659
  },
8660
+ {
8661
+ "key": "userChannels",
8662
+ "method": "GET",
8663
+ "path": "/users/:name/channels",
8664
+ "fullPath": "/internal/agent-api/users/:name/channels",
8665
+ "client": {
8666
+ "resource": "users",
8667
+ "method": "channels"
8668
+ },
8669
+ "capability": "channels",
8670
+ "description": "One visible agent or human (exact name, agents first; the serverInfo entry) and which of one window of your visible channels (serverInfo order, offset/limit, limit at most 200) list them as a member, in one request. Needs the read capability as well. 404 user_not_found when no visible user has that name.",
8671
+ "sideEffect": "read",
8672
+ "idempotency": "natural",
8673
+ "destructive": false,
8674
+ "audience": "both",
8675
+ "request": {
8676
+ "params": true,
8677
+ "query": true,
8678
+ "body": false
8679
+ },
8680
+ "response": {
8681
+ "kind": "json",
8682
+ "body": true
8683
+ }
8684
+ },
8611
8685
  {
8612
8686
  "key": "serverUpdate",
8613
8687
  "method": "PATCH",
@@ -9910,7 +9984,7 @@ const AGENT_API_ROUTE_MANIFEST = [
9910
9984
  }
9911
9985
  ];
9912
9986
  /** Content hash of AGENT_API_ROUTE_MANIFEST; see computeAgentApiManifestVersion. */
9913
- const AGENT_API_MANIFEST_VERSION = "c762a744e3542f89";
9987
+ const AGENT_API_MANIFEST_VERSION = "edd02bcf059dbd7c";
9914
9988
  //#endregion
9915
9989
  //#region src/routes.ts
9916
9990
  const ROUTE_INFO = Object.fromEntries(AGENT_API_ROUTE_MANIFEST.map((entry) => {
@@ -13861,12 +13935,23 @@ async function updateProfile(client, request, options = {}) {
13861
13935
  const userInfoRequestSchema = requestSchema()(object({
13862
13936
  name: string().describe("The human or agent, `@handle` (or the bare handle)."),
13863
13937
  offset: number$1().int().nonnegative().optional().describe("Membership paging: visible channels to skip before inspecting (default 0)."),
13864
- limit: number$1().int().positive().optional().describe("Membership paging: visible channels to inspect (default 50).")
13938
+ limit: number$1().int().positive().max(200).optional().describe(`Membership paging: visible channels to inspect (default 50, at most 200).`)
13865
13939
  }));
13940
+ /** The route's gate refused this credential (capability, grant, or runner session); `server.info` decides what remains visible. */
13941
+ function isUserChannelsGateRefusal(result) {
13942
+ if (result.error.kind !== "http") return false;
13943
+ return result.error.status === 403 || result.error.status === 501 && result.error.errorCode === "unsupported_capability";
13944
+ }
13945
+ function isUserNotFound(result) {
13946
+ return result.error.kind === "http" && result.error.status === 404 && result.error.errorCode === "user_not_found";
13947
+ }
13866
13948
  /**
13867
- * `raft user info <name>`: the user's visible facts from `server.info`, and
13868
- * their memberships among one page of the visible channels, checked one
13869
- * channel roster at a time (a rejected roster is skipped and counted).
13949
+ * `raft user info <name>`: the user's visible facts (their `server.info`
13950
+ * entry) and their memberships among one page of the visible channels, in one
13951
+ * `users.channels` request. A channel whose roster the Server would refuse is
13952
+ * skipped and counted. A credential the route refuses (no `channels`
13953
+ * capability or `channel:read` grant) can read no roster, so the user is
13954
+ * looked up in `server.info` and every inspected channel is skipped.
13870
13955
  */
13871
13956
  async function userInfo(client, request, options = {}) {
13872
13957
  const invalid = validateOpRequest(userInfoRequestSchema, request);
@@ -13876,18 +13961,7 @@ async function userInfo(client, request, options = {}) {
13876
13961
  if (!name) return failureOutcome(opError("INVALID_REQUEST", { message: "user name is required" }));
13877
13962
  const limit = request.limit ?? 50;
13878
13963
  const offset = request.offset ?? 0;
13879
- const info = await client.server.info();
13880
- if (!info.ok) return failureFromClientResult(info);
13881
- const agent = info.data.agents.find((candidate) => candidate.name === name);
13882
- const human = info.data.humans.find((candidate) => candidate.name === name);
13883
- const user = agent ? {
13884
- kind: "agent",
13885
- value: agent
13886
- } : human ? {
13887
- kind: "human",
13888
- value: human
13889
- } : null;
13890
- if (!user) return failureOutcome(opError("NOT_FOUND", {
13964
+ const notFound = () => failureOutcome(opError("NOT_FOUND", {
13891
13965
  message: `User not found or not visible: @${name}`,
13892
13966
  nextAction: `Run \`${formatHint(RAFT_HINTS.serverInfo({
13893
13967
  view: "agents",
@@ -13897,30 +13971,57 @@ async function userInfo(client, request, options = {}) {
13897
13971
  query: true
13898
13972
  }), options.hints)}\` to inspect visible users.`
13899
13973
  }));
13900
- const visibleChannels = info.data.channels;
13901
- const memberships = [];
13902
- let skippedChannels = 0;
13903
- for (const channel of visibleChannels.slice(offset, offset + limit)) {
13904
- const members = await client.channels.members({ channel: `#${channel.name}` });
13905
- if (!members.ok) {
13906
- skippedChannels += 1;
13907
- continue;
13908
- }
13909
- if ((user.kind === "agent" ? members.data.agents ?? [] : members.data.humans ?? []).some((candidate) => candidate.name === name)) memberships.push({
13974
+ let user;
13975
+ let memberships;
13976
+ let skippedChannels;
13977
+ let total;
13978
+ const result = await client.users.channels({ name }, {
13979
+ offset: String(offset),
13980
+ limit: String(limit)
13981
+ });
13982
+ if (result.ok) {
13983
+ user = result.data.kind === "agent" ? {
13984
+ kind: "agent",
13985
+ value: result.data.user
13986
+ } : {
13987
+ kind: "human",
13988
+ value: result.data.user
13989
+ };
13990
+ memberships = result.data.memberships.map((channel) => ({
13910
13991
  ...channel,
13911
13992
  joined: true,
13912
13993
  muted: void 0,
13913
13994
  activityMuted: void 0
13914
- });
13915
- }
13995
+ }));
13996
+ skippedChannels = result.data.uncheckedCount;
13997
+ total = result.data.page.total;
13998
+ } else if (isUserNotFound(result)) return notFound();
13999
+ else if (isUserChannelsGateRefusal(result)) {
14000
+ const info = await client.server.info();
14001
+ if (!info.ok) return failureFromClientResult(info);
14002
+ const agent = info.data.agents.find((candidate) => candidate.name === name);
14003
+ const human = info.data.humans.find((candidate) => candidate.name === name);
14004
+ if (agent) user = {
14005
+ kind: "agent",
14006
+ value: agent
14007
+ };
14008
+ else if (human) user = {
14009
+ kind: "human",
14010
+ value: human
14011
+ };
14012
+ else return notFound();
14013
+ memberships = [];
14014
+ skippedChannels = info.data.channels.slice(offset, offset + limit).length;
14015
+ total = info.data.channels.length;
14016
+ } else return failureFromClientResult(result);
13916
14017
  const nextOffset = offset + limit;
13917
- const nextHint = nextOffset < visibleChannels.length ? RAFT_HINTS.userInfo({
14018
+ const nextHint = nextOffset < total ? RAFT_HINTS.userInfo({
13918
14019
  name,
13919
14020
  offset: nextOffset,
13920
14021
  limit
13921
14022
  }) : null;
13922
14023
  const page = {
13923
- total: visibleChannels.length,
14024
+ total,
13924
14025
  offset,
13925
14026
  limit,
13926
14027
  nextCommand: nextHint ? formatHint(nextHint, options.hints) : void 0
@@ -14722,11 +14823,6 @@ function formatAgentSenderMentionDeliveries(messageId, deliveries) {
14722
14823
  //#region ../shared/src/agentOps/mentions.ts
14723
14824
  const pendingMentionActionsRequestSchema = requestSchema()(object({ limit: number$1().int().positive().optional().describe("Maximum pending mentions to list.") }));
14724
14825
  const mentionResolutionIdsRequestSchema = requestSchema()(object({ resolutionIds: array(string()).describe("resolutionId values from mentions.pending.") }));
14725
- /** @deprecated The request of the deprecated `mentions.execute`; use `mentionResolutionIdsRequestSchema` (`mentions.notify` / `mentions.add`). */
14726
- const executeMentionActionRequestSchema = requestSchema()(object({
14727
- action: _enum(["notify", "add"]).describe("notify: tell the mentioned target about the message; add: add them to the conversation."),
14728
- resolutionIds: array(string()).describe("resolutionId values from mentions.pending.")
14729
- }));
14730
14826
  const senderMentionDeliveriesRequestSchema = requestSchema()(object({ messageId: string().describe("Id of a message you sent.") }));
14731
14827
  async function pendingMentionActions(client, request = {}, options = {}) {
14732
14828
  const invalid = validateOpRequest(pendingMentionActionsRequestSchema, request);
@@ -14769,17 +14865,9 @@ async function addMentions(client, request) {
14769
14865
  if (invalid) return invalid;
14770
14866
  return runMentionAction(client, "add", request.resolutionIds);
14771
14867
  }
14772
- /** @deprecated Backs the deprecated `mentions.execute`; use `notifyMentions` / `addMentions`. */
14773
- async function executeMentionAction(client, request) {
14774
- const invalid = validateOpRequest(executeMentionActionRequestSchema, request);
14775
- if (invalid) return invalid;
14776
- const missing = "Pass an action (notify | add) and at least one resolution id.";
14777
- if (request.action !== "notify" && request.action !== "add") return failureOutcome(opError("INVALID_REQUEST", { message: missing }));
14778
- return runMentionAction(client, request.action, request.resolutionIds, missing);
14779
- }
14780
- async function runMentionAction(client, action, resolutionIds, missingIdsMessage = "Pass at least one resolution id.") {
14868
+ async function runMentionAction(client, action, resolutionIds) {
14781
14869
  const ids = (resolutionIds ?? []).map((id) => id.trim()).filter(Boolean);
14782
- if (ids.length === 0) return failureOutcome(opError("INVALID_REQUEST", { message: missingIdsMessage }));
14870
+ if (ids.length === 0) return failureOutcome(opError("INVALID_REQUEST", { message: "Pass at least one resolution id." }));
14783
14871
  const result = await client.mentions.executeAction({
14784
14872
  action,
14785
14873
  resolutionIds: ids
@@ -15589,24 +15677,6 @@ const OPERATION_DEFS = [
15589
15677
  consumes: nothing,
15590
15678
  output: small
15591
15679
  },
15592
- {
15593
- name: "mentions.execute",
15594
- description: "Deprecated: use mentions.notify / mentions.add. Removed in the next minor release. Deliver unreached @mentions: notify the mentioned target, or add them to the conversation.",
15595
- schema: executeMentionActionRequestSchema,
15596
- routes: ["mentionActionsExecute"],
15597
- consumes: nothing,
15598
- output: small,
15599
- deprecated: true
15600
- },
15601
- {
15602
- name: "mentions.deliveries",
15603
- description: "Deprecated: use mentions.delivery. Removed in the next minor release. Whether each @mention in a message you sent reached its target.",
15604
- schema: senderMentionDeliveriesRequestSchema,
15605
- routes: ["senderMentionDeliveries"],
15606
- consumes: nothing,
15607
- output: small,
15608
- deprecated: true
15609
- },
15610
15680
  {
15611
15681
  name: "actions.prepare",
15612
15682
  description: "Post an action card (create a channel, add members, create an agent, or an integration step) for a human to confirm; the human who clicks it carries it out as themselves. When it is executed (or fails), the outcome arrives as a reply that @mentions you in the card's thread (or in the thread the card was posted in).",
@@ -15841,7 +15911,7 @@ const OPERATION_DEFS = [
15841
15911
  name: "users.info",
15842
15912
  description: "A human's or agent's visible facts (kind, status, role, description) and which visible channels they are in. Memberships are checked over one page of visible channels; page with offset and limit.",
15843
15913
  schema: userInfoRequestSchema,
15844
- routes: ["serverInfo", "channelMembers"],
15914
+ routes: ["userChannels", "serverInfo"],
15845
15915
  consumes: nothing,
15846
15916
  output: {
15847
15917
  mayBeLarge: true,
@@ -16080,9 +16150,7 @@ function createRaft(options) {
16080
16150
  pending: (request) => pendingMentionActions(api, request, style).then(styled),
16081
16151
  notify: (request) => notifyMentions(api, request).then(styled),
16082
16152
  add: (request) => addMentions(api, request).then(styled),
16083
- delivery: (request) => senderMentionDeliveries(api, request).then(styled),
16084
- execute: (request) => executeMentionAction(api, request).then(styled),
16085
- deliveries: (request) => senderMentionDeliveries(api, request).then(styled)
16153
+ delivery: (request) => senderMentionDeliveries(api, request).then(styled)
16086
16154
  },
16087
16155
  actions: { prepare: (request) => prepareActionCard(api, request, style).then(styled) },
16088
16156
  manual: {
@@ -16174,8 +16242,6 @@ function createRaft(options) {
16174
16242
  "mentions.notify": (args) => raft.mentions.notify(args),
16175
16243
  "mentions.add": (args) => raft.mentions.add(args),
16176
16244
  "mentions.delivery": (args) => raft.mentions.delivery(args),
16177
- "mentions.execute": (args) => raft.mentions.execute(args),
16178
- "mentions.deliveries": (args) => raft.mentions.deliveries(args),
16179
16245
  "actions.prepare": (args) => raft.actions.prepare(args),
16180
16246
  "manual.get": (args) => raft.manual.get(args),
16181
16247
  "manual.search": (args) => raft.manual.search(args),
@@ -16277,7 +16343,6 @@ exports.createTasksRequestSchema = createTasksRequestSchema;
16277
16343
  exports.describeRaftRoute = describeRaftRoute;
16278
16344
  exports.downloadAttachmentUrlRequestSchema = downloadAttachmentUrlRequestSchema;
16279
16345
  exports.drainInboxRequestSchema = drainInboxRequestSchema;
16280
- exports.executeMentionActionRequestSchema = executeMentionActionRequestSchema;
16281
16346
  exports.getManualTopicRequestSchema = getManualTopicRequestSchema;
16282
16347
  exports.hasAgentMessageIdentity = hasAgentMessageIdentity;
16283
16348
  exports.hashRaftSendContent = hashRaftSendContent;
package/dist/esm/index.js CHANGED
@@ -4706,6 +4706,7 @@ const AGENT_API_ROUTE_META = {
4706
4706
  inboxList: read,
4707
4707
  agentContext: read,
4708
4708
  serverInfo: read,
4709
+ userChannels: read,
4709
4710
  serverUpdate: naturalDestructive,
4710
4711
  mentionActionsPending: read,
4711
4712
  senderMentionDeliveries: read,
@@ -5707,6 +5708,31 @@ const agentApiAgentContextResponseSchema = passthroughObject({
5707
5708
  text: string()
5708
5709
  }).nullable()
5709
5710
  });
5711
+ const agentApiServerInfoChannelSchema = passthroughObject({
5712
+ id: string().transform(asChannelId),
5713
+ name: string(),
5714
+ joined: boolean()
5715
+ });
5716
+ const agentApiServerInfoAgentSchema = passthroughObject({
5717
+ name: string(),
5718
+ status: string().optional(),
5719
+ activity: string().nullable().optional(),
5720
+ activityDetail: string().nullable().optional(),
5721
+ role: _enum([
5722
+ "owner",
5723
+ "admin",
5724
+ "member"
5725
+ ]).nullable().optional()
5726
+ });
5727
+ const agentApiServerInfoHumanSchema = passthroughObject({
5728
+ name: string(),
5729
+ role: _enum([
5730
+ "owner",
5731
+ "admin",
5732
+ "member",
5733
+ "guest"
5734
+ ]).nullable().optional()
5735
+ });
5710
5736
  const agentApiServerInfoResponseSchema = passthroughObject({
5711
5737
  runtimeContext: passthroughObject({
5712
5738
  agentId: string(),
@@ -5724,32 +5750,39 @@ const agentApiServerInfoResponseSchema = passthroughObject({
5724
5750
  }),
5725
5751
  serverRole: string().nullable().optional(),
5726
5752
  serverCapabilities: passthroughObject({}).optional(),
5727
- channels: array(passthroughObject({
5728
- id: string().transform(asChannelId),
5729
- name: string(),
5730
- joined: boolean()
5731
- })),
5732
- agents: array(passthroughObject({
5733
- name: string(),
5734
- status: string().optional(),
5735
- activity: string().nullable().optional(),
5736
- activityDetail: string().nullable().optional(),
5737
- role: _enum([
5738
- "owner",
5739
- "admin",
5740
- "member"
5741
- ]).nullable().optional()
5742
- })),
5743
- humans: array(passthroughObject({
5744
- name: string(),
5745
- role: _enum([
5746
- "owner",
5747
- "admin",
5748
- "member",
5749
- "guest"
5750
- ]).nullable().optional()
5751
- }))
5752
- });
5753
+ channels: array(agentApiServerInfoChannelSchema),
5754
+ agents: array(agentApiServerInfoAgentSchema),
5755
+ humans: array(agentApiServerInfoHumanSchema)
5756
+ });
5757
+ const nonNegativeIntegerStringSchema = string().trim().regex(/^(0|[1-9][0-9]*)$/, "must be a non-negative integer");
5758
+ const agentApiUserChannelsParamsSchema = passthroughObject({ name: string().trim().min(1) });
5759
+ const agentApiUserChannelsQuerySchema = passthroughObject({
5760
+ offset: nonNegativeIntegerStringSchema.optional(),
5761
+ limit: string().trim().regex(/^([1-9]|[1-9][0-9]|1[0-9][0-9]|200)$/, "must be an integer from 1 to 200").optional()
5762
+ });
5763
+ const agentApiUserChannelsPageFields = {
5764
+ memberships: array(agentApiServerInfoChannelSchema),
5765
+ uncheckedCount: number$1().int().nonnegative(),
5766
+ page: passthroughObject({
5767
+ total: number$1().int().nonnegative(),
5768
+ offset: number$1().int().nonnegative(),
5769
+ limit: number$1().int().positive()
5770
+ })
5771
+ };
5772
+ /**
5773
+ * One user's visible facts and their memberships among one window of the
5774
+ * caller's visible channels (`GET /users/:name/channels`). `user` is the
5775
+ * user's `serverInfo` agents / humans entry, unchanged.
5776
+ */
5777
+ const agentApiUserChannelsResponseSchema = discriminatedUnion("kind", [passthroughObject({
5778
+ user: agentApiServerInfoAgentSchema,
5779
+ kind: literal("agent"),
5780
+ ...agentApiUserChannelsPageFields
5781
+ }), passthroughObject({
5782
+ user: agentApiServerInfoHumanSchema,
5783
+ kind: literal("human"),
5784
+ ...agentApiUserChannelsPageFields
5785
+ })]);
5753
5786
  const agentApiMentionActionsPendingQuerySchema = passthroughObject({ limit: optionalStringSchema });
5754
5787
  const agentApiMentionActionEnvelopeSchema = passthroughObject({ resolutionId: string() });
5755
5788
  const agentApiMentionActionResultSchema = passthroughObject({
@@ -6742,6 +6775,22 @@ const agentApiContract = {
6742
6775
  request: {},
6743
6776
  response: { body: agentApiServerInfoResponseSchema }
6744
6777
  }),
6778
+ userChannels: route({
6779
+ key: "userChannels",
6780
+ method: "GET",
6781
+ path: "/users/:name/channels",
6782
+ client: {
6783
+ resource: "users",
6784
+ method: "channels"
6785
+ },
6786
+ capability: "channels",
6787
+ description: "One visible agent or human (exact name, agents first; the serverInfo entry) and which of one window of your visible channels (serverInfo order, offset/limit, limit at most 200) list them as a member, in one request. Needs the read capability as well. 404 user_not_found when no visible user has that name.",
6788
+ request: {
6789
+ params: agentApiUserChannelsParamsSchema,
6790
+ query: agentApiUserChannelsQuerySchema
6791
+ },
6792
+ response: { body: agentApiUserChannelsResponseSchema }
6793
+ }),
6745
6794
  serverUpdate: route({
6746
6795
  key: "serverUpdate",
6747
6796
  method: "PATCH",
@@ -8607,6 +8656,31 @@ const AGENT_API_ROUTE_MANIFEST = [
8607
8656
  "body": true
8608
8657
  }
8609
8658
  },
8659
+ {
8660
+ "key": "userChannels",
8661
+ "method": "GET",
8662
+ "path": "/users/:name/channels",
8663
+ "fullPath": "/internal/agent-api/users/:name/channels",
8664
+ "client": {
8665
+ "resource": "users",
8666
+ "method": "channels"
8667
+ },
8668
+ "capability": "channels",
8669
+ "description": "One visible agent or human (exact name, agents first; the serverInfo entry) and which of one window of your visible channels (serverInfo order, offset/limit, limit at most 200) list them as a member, in one request. Needs the read capability as well. 404 user_not_found when no visible user has that name.",
8670
+ "sideEffect": "read",
8671
+ "idempotency": "natural",
8672
+ "destructive": false,
8673
+ "audience": "both",
8674
+ "request": {
8675
+ "params": true,
8676
+ "query": true,
8677
+ "body": false
8678
+ },
8679
+ "response": {
8680
+ "kind": "json",
8681
+ "body": true
8682
+ }
8683
+ },
8610
8684
  {
8611
8685
  "key": "serverUpdate",
8612
8686
  "method": "PATCH",
@@ -9909,7 +9983,7 @@ const AGENT_API_ROUTE_MANIFEST = [
9909
9983
  }
9910
9984
  ];
9911
9985
  /** Content hash of AGENT_API_ROUTE_MANIFEST; see computeAgentApiManifestVersion. */
9912
- const AGENT_API_MANIFEST_VERSION = "c762a744e3542f89";
9986
+ const AGENT_API_MANIFEST_VERSION = "edd02bcf059dbd7c";
9913
9987
  //#endregion
9914
9988
  //#region src/routes.ts
9915
9989
  const ROUTE_INFO = Object.fromEntries(AGENT_API_ROUTE_MANIFEST.map((entry) => {
@@ -13860,12 +13934,23 @@ async function updateProfile(client, request, options = {}) {
13860
13934
  const userInfoRequestSchema = requestSchema()(object({
13861
13935
  name: string().describe("The human or agent, `@handle` (or the bare handle)."),
13862
13936
  offset: number$1().int().nonnegative().optional().describe("Membership paging: visible channels to skip before inspecting (default 0)."),
13863
- limit: number$1().int().positive().optional().describe("Membership paging: visible channels to inspect (default 50).")
13937
+ limit: number$1().int().positive().max(200).optional().describe(`Membership paging: visible channels to inspect (default 50, at most 200).`)
13864
13938
  }));
13939
+ /** The route's gate refused this credential (capability, grant, or runner session); `server.info` decides what remains visible. */
13940
+ function isUserChannelsGateRefusal(result) {
13941
+ if (result.error.kind !== "http") return false;
13942
+ return result.error.status === 403 || result.error.status === 501 && result.error.errorCode === "unsupported_capability";
13943
+ }
13944
+ function isUserNotFound(result) {
13945
+ return result.error.kind === "http" && result.error.status === 404 && result.error.errorCode === "user_not_found";
13946
+ }
13865
13947
  /**
13866
- * `raft user info <name>`: the user's visible facts from `server.info`, and
13867
- * their memberships among one page of the visible channels, checked one
13868
- * channel roster at a time (a rejected roster is skipped and counted).
13948
+ * `raft user info <name>`: the user's visible facts (their `server.info`
13949
+ * entry) and their memberships among one page of the visible channels, in one
13950
+ * `users.channels` request. A channel whose roster the Server would refuse is
13951
+ * skipped and counted. A credential the route refuses (no `channels`
13952
+ * capability or `channel:read` grant) can read no roster, so the user is
13953
+ * looked up in `server.info` and every inspected channel is skipped.
13869
13954
  */
13870
13955
  async function userInfo(client, request, options = {}) {
13871
13956
  const invalid = validateOpRequest(userInfoRequestSchema, request);
@@ -13875,18 +13960,7 @@ async function userInfo(client, request, options = {}) {
13875
13960
  if (!name) return failureOutcome(opError("INVALID_REQUEST", { message: "user name is required" }));
13876
13961
  const limit = request.limit ?? 50;
13877
13962
  const offset = request.offset ?? 0;
13878
- const info = await client.server.info();
13879
- if (!info.ok) return failureFromClientResult(info);
13880
- const agent = info.data.agents.find((candidate) => candidate.name === name);
13881
- const human = info.data.humans.find((candidate) => candidate.name === name);
13882
- const user = agent ? {
13883
- kind: "agent",
13884
- value: agent
13885
- } : human ? {
13886
- kind: "human",
13887
- value: human
13888
- } : null;
13889
- if (!user) return failureOutcome(opError("NOT_FOUND", {
13963
+ const notFound = () => failureOutcome(opError("NOT_FOUND", {
13890
13964
  message: `User not found or not visible: @${name}`,
13891
13965
  nextAction: `Run \`${formatHint(RAFT_HINTS.serverInfo({
13892
13966
  view: "agents",
@@ -13896,30 +13970,57 @@ async function userInfo(client, request, options = {}) {
13896
13970
  query: true
13897
13971
  }), options.hints)}\` to inspect visible users.`
13898
13972
  }));
13899
- const visibleChannels = info.data.channels;
13900
- const memberships = [];
13901
- let skippedChannels = 0;
13902
- for (const channel of visibleChannels.slice(offset, offset + limit)) {
13903
- const members = await client.channels.members({ channel: `#${channel.name}` });
13904
- if (!members.ok) {
13905
- skippedChannels += 1;
13906
- continue;
13907
- }
13908
- if ((user.kind === "agent" ? members.data.agents ?? [] : members.data.humans ?? []).some((candidate) => candidate.name === name)) memberships.push({
13973
+ let user;
13974
+ let memberships;
13975
+ let skippedChannels;
13976
+ let total;
13977
+ const result = await client.users.channels({ name }, {
13978
+ offset: String(offset),
13979
+ limit: String(limit)
13980
+ });
13981
+ if (result.ok) {
13982
+ user = result.data.kind === "agent" ? {
13983
+ kind: "agent",
13984
+ value: result.data.user
13985
+ } : {
13986
+ kind: "human",
13987
+ value: result.data.user
13988
+ };
13989
+ memberships = result.data.memberships.map((channel) => ({
13909
13990
  ...channel,
13910
13991
  joined: true,
13911
13992
  muted: void 0,
13912
13993
  activityMuted: void 0
13913
- });
13914
- }
13994
+ }));
13995
+ skippedChannels = result.data.uncheckedCount;
13996
+ total = result.data.page.total;
13997
+ } else if (isUserNotFound(result)) return notFound();
13998
+ else if (isUserChannelsGateRefusal(result)) {
13999
+ const info = await client.server.info();
14000
+ if (!info.ok) return failureFromClientResult(info);
14001
+ const agent = info.data.agents.find((candidate) => candidate.name === name);
14002
+ const human = info.data.humans.find((candidate) => candidate.name === name);
14003
+ if (agent) user = {
14004
+ kind: "agent",
14005
+ value: agent
14006
+ };
14007
+ else if (human) user = {
14008
+ kind: "human",
14009
+ value: human
14010
+ };
14011
+ else return notFound();
14012
+ memberships = [];
14013
+ skippedChannels = info.data.channels.slice(offset, offset + limit).length;
14014
+ total = info.data.channels.length;
14015
+ } else return failureFromClientResult(result);
13915
14016
  const nextOffset = offset + limit;
13916
- const nextHint = nextOffset < visibleChannels.length ? RAFT_HINTS.userInfo({
14017
+ const nextHint = nextOffset < total ? RAFT_HINTS.userInfo({
13917
14018
  name,
13918
14019
  offset: nextOffset,
13919
14020
  limit
13920
14021
  }) : null;
13921
14022
  const page = {
13922
- total: visibleChannels.length,
14023
+ total,
13923
14024
  offset,
13924
14025
  limit,
13925
14026
  nextCommand: nextHint ? formatHint(nextHint, options.hints) : void 0
@@ -14721,11 +14822,6 @@ function formatAgentSenderMentionDeliveries(messageId, deliveries) {
14721
14822
  //#region ../shared/src/agentOps/mentions.ts
14722
14823
  const pendingMentionActionsRequestSchema = requestSchema()(object({ limit: number$1().int().positive().optional().describe("Maximum pending mentions to list.") }));
14723
14824
  const mentionResolutionIdsRequestSchema = requestSchema()(object({ resolutionIds: array(string()).describe("resolutionId values from mentions.pending.") }));
14724
- /** @deprecated The request of the deprecated `mentions.execute`; use `mentionResolutionIdsRequestSchema` (`mentions.notify` / `mentions.add`). */
14725
- const executeMentionActionRequestSchema = requestSchema()(object({
14726
- action: _enum(["notify", "add"]).describe("notify: tell the mentioned target about the message; add: add them to the conversation."),
14727
- resolutionIds: array(string()).describe("resolutionId values from mentions.pending.")
14728
- }));
14729
14825
  const senderMentionDeliveriesRequestSchema = requestSchema()(object({ messageId: string().describe("Id of a message you sent.") }));
14730
14826
  async function pendingMentionActions(client, request = {}, options = {}) {
14731
14827
  const invalid = validateOpRequest(pendingMentionActionsRequestSchema, request);
@@ -14768,17 +14864,9 @@ async function addMentions(client, request) {
14768
14864
  if (invalid) return invalid;
14769
14865
  return runMentionAction(client, "add", request.resolutionIds);
14770
14866
  }
14771
- /** @deprecated Backs the deprecated `mentions.execute`; use `notifyMentions` / `addMentions`. */
14772
- async function executeMentionAction(client, request) {
14773
- const invalid = validateOpRequest(executeMentionActionRequestSchema, request);
14774
- if (invalid) return invalid;
14775
- const missing = "Pass an action (notify | add) and at least one resolution id.";
14776
- if (request.action !== "notify" && request.action !== "add") return failureOutcome(opError("INVALID_REQUEST", { message: missing }));
14777
- return runMentionAction(client, request.action, request.resolutionIds, missing);
14778
- }
14779
- async function runMentionAction(client, action, resolutionIds, missingIdsMessage = "Pass at least one resolution id.") {
14867
+ async function runMentionAction(client, action, resolutionIds) {
14780
14868
  const ids = (resolutionIds ?? []).map((id) => id.trim()).filter(Boolean);
14781
- if (ids.length === 0) return failureOutcome(opError("INVALID_REQUEST", { message: missingIdsMessage }));
14869
+ if (ids.length === 0) return failureOutcome(opError("INVALID_REQUEST", { message: "Pass at least one resolution id." }));
14782
14870
  const result = await client.mentions.executeAction({
14783
14871
  action,
14784
14872
  resolutionIds: ids
@@ -15588,24 +15676,6 @@ const OPERATION_DEFS = [
15588
15676
  consumes: nothing,
15589
15677
  output: small
15590
15678
  },
15591
- {
15592
- name: "mentions.execute",
15593
- description: "Deprecated: use mentions.notify / mentions.add. Removed in the next minor release. Deliver unreached @mentions: notify the mentioned target, or add them to the conversation.",
15594
- schema: executeMentionActionRequestSchema,
15595
- routes: ["mentionActionsExecute"],
15596
- consumes: nothing,
15597
- output: small,
15598
- deprecated: true
15599
- },
15600
- {
15601
- name: "mentions.deliveries",
15602
- description: "Deprecated: use mentions.delivery. Removed in the next minor release. Whether each @mention in a message you sent reached its target.",
15603
- schema: senderMentionDeliveriesRequestSchema,
15604
- routes: ["senderMentionDeliveries"],
15605
- consumes: nothing,
15606
- output: small,
15607
- deprecated: true
15608
- },
15609
15679
  {
15610
15680
  name: "actions.prepare",
15611
15681
  description: "Post an action card (create a channel, add members, create an agent, or an integration step) for a human to confirm; the human who clicks it carries it out as themselves. When it is executed (or fails), the outcome arrives as a reply that @mentions you in the card's thread (or in the thread the card was posted in).",
@@ -15840,7 +15910,7 @@ const OPERATION_DEFS = [
15840
15910
  name: "users.info",
15841
15911
  description: "A human's or agent's visible facts (kind, status, role, description) and which visible channels they are in. Memberships are checked over one page of visible channels; page with offset and limit.",
15842
15912
  schema: userInfoRequestSchema,
15843
- routes: ["serverInfo", "channelMembers"],
15913
+ routes: ["userChannels", "serverInfo"],
15844
15914
  consumes: nothing,
15845
15915
  output: {
15846
15916
  mayBeLarge: true,
@@ -16079,9 +16149,7 @@ function createRaft(options) {
16079
16149
  pending: (request) => pendingMentionActions(api, request, style).then(styled),
16080
16150
  notify: (request) => notifyMentions(api, request).then(styled),
16081
16151
  add: (request) => addMentions(api, request).then(styled),
16082
- delivery: (request) => senderMentionDeliveries(api, request).then(styled),
16083
- execute: (request) => executeMentionAction(api, request).then(styled),
16084
- deliveries: (request) => senderMentionDeliveries(api, request).then(styled)
16152
+ delivery: (request) => senderMentionDeliveries(api, request).then(styled)
16085
16153
  },
16086
16154
  actions: { prepare: (request) => prepareActionCard(api, request, style).then(styled) },
16087
16155
  manual: {
@@ -16173,8 +16241,6 @@ function createRaft(options) {
16173
16241
  "mentions.notify": (args) => raft.mentions.notify(args),
16174
16242
  "mentions.add": (args) => raft.mentions.add(args),
16175
16243
  "mentions.delivery": (args) => raft.mentions.delivery(args),
16176
- "mentions.execute": (args) => raft.mentions.execute(args),
16177
- "mentions.deliveries": (args) => raft.mentions.deliveries(args),
16178
16244
  "actions.prepare": (args) => raft.actions.prepare(args),
16179
16245
  "manual.get": (args) => raft.manual.get(args),
16180
16246
  "manual.search": (args) => raft.manual.search(args),
@@ -16243,4 +16309,4 @@ function whoamiOutcome(result) {
16243
16309
  };
16244
16310
  }
16245
16311
  //#endregion
16246
- export { RAFT_INBOX_NOTICE_SCHEMA, RAFT_JSON_SCHEMA_KEYWORDS, RAFT_NOTICE_DELIVERY_ID_HEADER, RAFT_NOTICE_SIGNATURE_HEADER, RAFT_OPERATIONS, RAFT_OPERATIONS_SCHEMA, RAFT_OPERATIONS_VERSION, RAFT_STATE_CONTINUATIONS_PER_TARGET, RAFT_STATE_CONTINUATIONS_TOTAL, RAFT_STATE_SCHEMA, RaftCredentialError, RaftSdkConfigurationError, SeenFrontier, amendTaskRequestSchema, assignTaskRequestSchema, attachmentCommentsRequestSchema, bootstrapRaftCredential, channelInfoRequestSchema, channelMembersRequestSchema, channelTargetRequestSchema, checkInboxRequestSchema, claimTasksRequestSchema, commitInboxRequestSchema, convertMessageToTaskRequestSchema, createFileCredentialStore, createRaft, createRaftClient, createRaftClientFromStore, createRaftRoutes, createTasksRequestSchema, describeRaftRoute, downloadAttachmentUrlRequestSchema, drainInboxRequestSchema, executeMentionActionRequestSchema, getManualTopicRequestSchema, hasAgentMessageIdentity, hashRaftSendContent, inferAttachmentMimeType, isInterrupted, joinRaftChannelByTarget, listInboxRequestSchema, listRaftRoutes, listTasksRequestSchema, listThreadsRequestSchema, mentionResolutionIdsRequestSchema, parseRaftRegularChannelTarget, parseRaftState, pendingMentionActionsRequestSchema, prepareActionCardRequestSchema, projectRaftMessage, projectRaftMessages, raftToolNameFor, reactRequestSchema, readHistoryRequestSchema, readLatestReadThread, replyToRequestSchema, resolveMessageRequestSchema, searchManualRequestSchema, searchMessagesRequestSchema, sendMessageRequestSchema, senderMentionDeliveriesRequestSchema, serverInfoRequestSchema, showProfileRequestSchema, taskRefSchema, unfollowThreadRequestSchema, updateProfileRequestSchema, updateTaskStatusRequestSchema, userInfoRequestSchema, verifyInboxNotice, whoamiRequestSchema };
16312
+ export { RAFT_INBOX_NOTICE_SCHEMA, RAFT_JSON_SCHEMA_KEYWORDS, RAFT_NOTICE_DELIVERY_ID_HEADER, RAFT_NOTICE_SIGNATURE_HEADER, RAFT_OPERATIONS, RAFT_OPERATIONS_SCHEMA, RAFT_OPERATIONS_VERSION, RAFT_STATE_CONTINUATIONS_PER_TARGET, RAFT_STATE_CONTINUATIONS_TOTAL, RAFT_STATE_SCHEMA, RaftCredentialError, RaftSdkConfigurationError, SeenFrontier, amendTaskRequestSchema, assignTaskRequestSchema, attachmentCommentsRequestSchema, bootstrapRaftCredential, channelInfoRequestSchema, channelMembersRequestSchema, channelTargetRequestSchema, checkInboxRequestSchema, claimTasksRequestSchema, commitInboxRequestSchema, convertMessageToTaskRequestSchema, createFileCredentialStore, createRaft, createRaftClient, createRaftClientFromStore, createRaftRoutes, createTasksRequestSchema, describeRaftRoute, downloadAttachmentUrlRequestSchema, drainInboxRequestSchema, getManualTopicRequestSchema, hasAgentMessageIdentity, hashRaftSendContent, inferAttachmentMimeType, isInterrupted, joinRaftChannelByTarget, listInboxRequestSchema, listRaftRoutes, listTasksRequestSchema, listThreadsRequestSchema, mentionResolutionIdsRequestSchema, parseRaftRegularChannelTarget, parseRaftState, pendingMentionActionsRequestSchema, prepareActionCardRequestSchema, projectRaftMessage, projectRaftMessages, raftToolNameFor, reactRequestSchema, readHistoryRequestSchema, readLatestReadThread, replyToRequestSchema, resolveMessageRequestSchema, searchManualRequestSchema, searchMessagesRequestSchema, sendMessageRequestSchema, senderMentionDeliveriesRequestSchema, serverInfoRequestSchema, showProfileRequestSchema, taskRefSchema, unfollowThreadRequestSchema, updateProfileRequestSchema, updateTaskStatusRequestSchema, userInfoRequestSchema, verifyInboxNotice, whoamiRequestSchema };
package/dist/index.d.ts CHANGED
@@ -1164,7 +1164,7 @@ interface UserInfoRequest {
1164
1164
  name: string;
1165
1165
  /** Visible channels to skip before inspecting memberships (default 0). */
1166
1166
  offset?: number;
1167
- /** Visible channels to inspect for memberships (default 50). */
1167
+ /** Visible channels to inspect for memberships (default 50, at most 200). */
1168
1168
  limit?: number;
1169
1169
  }
1170
1170
  export declare const userInfoRequestSchema: z.ZodObject<{
@@ -1298,14 +1298,6 @@ export declare const pendingMentionActionsRequestSchema: z.ZodObject<{
1298
1298
  export declare const mentionResolutionIdsRequestSchema: z.ZodObject<{
1299
1299
  resolutionIds: z.ZodArray<z.ZodString>;
1300
1300
  }, z.core.$strip>;
1301
- /** @deprecated The request of the deprecated `mentions.execute`; use `mentionResolutionIdsRequestSchema` (`mentions.notify` / `mentions.add`). */
1302
- export declare const executeMentionActionRequestSchema: z.ZodObject<{
1303
- action: z.ZodEnum<{
1304
- notify: "notify";
1305
- add: "add";
1306
- }>;
1307
- resolutionIds: z.ZodArray<z.ZodString>;
1308
- }, z.core.$strip>;
1309
1301
  export declare const senderMentionDeliveriesRequestSchema: z.ZodObject<{
1310
1302
  messageId: z.ZodString;
1311
1303
  }, z.core.$strip>;
@@ -1322,11 +1314,6 @@ type RaftMentionActionOutcome = RaftOutcome<{
1322
1314
  action: AgentMentionActionKind;
1323
1315
  results: AgentMentionActionResult[];
1324
1316
  }, "executed">;
1325
- /** @deprecated The request of the deprecated `mentions.execute`; use `MentionResolutionIdsRequest`. */
1326
- interface ExecuteMentionActionRequest {
1327
- action: AgentMentionActionKind;
1328
- resolutionIds: string[];
1329
- }
1330
1317
  //#endregion
1331
1318
  //#region ../shared/src/agentOps/manual.d.ts
1332
1319
  interface ManualContext {
@@ -2561,6 +2548,65 @@ declare const agentApiServerInfoResponseSchema: z.ZodObject<{
2561
2548
  }>>>;
2562
2549
  }, z.core.$loose>>;
2563
2550
  }, z.core.$loose>;
2551
+ declare const agentApiUserChannelsParamsSchema: z.ZodObject<{
2552
+ name: z.ZodString;
2553
+ }, z.core.$loose>;
2554
+ declare const agentApiUserChannelsQuerySchema: z.ZodObject<{
2555
+ offset: z.ZodOptional<z.ZodString>;
2556
+ limit: z.ZodOptional<z.ZodString>;
2557
+ }, z.core.$loose>;
2558
+ /**
2559
+ * One user's visible facts and their memberships among one window of the
2560
+ * caller's visible channels (`GET /users/:name/channels`). `user` is the
2561
+ * user's `serverInfo` agents / humans entry, unchanged.
2562
+ */
2563
+ declare const agentApiUserChannelsResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2564
+ memberships: z.ZodArray<z.ZodObject<{
2565
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<ChannelId, string>>;
2566
+ name: z.ZodString;
2567
+ joined: z.ZodBoolean;
2568
+ }, z.core.$loose>>;
2569
+ uncheckedCount: z.ZodNumber;
2570
+ page: z.ZodObject<{
2571
+ total: z.ZodNumber;
2572
+ offset: z.ZodNumber;
2573
+ limit: z.ZodNumber;
2574
+ }, z.core.$loose>;
2575
+ user: z.ZodObject<{
2576
+ name: z.ZodString;
2577
+ status: z.ZodOptional<z.ZodString>;
2578
+ activity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2579
+ activityDetail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2580
+ role: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
2581
+ owner: "owner";
2582
+ admin: "admin";
2583
+ member: "member";
2584
+ }>>>;
2585
+ }, z.core.$loose>;
2586
+ kind: z.ZodLiteral<"agent">;
2587
+ }, z.core.$loose>, z.ZodObject<{
2588
+ memberships: z.ZodArray<z.ZodObject<{
2589
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<ChannelId, string>>;
2590
+ name: z.ZodString;
2591
+ joined: z.ZodBoolean;
2592
+ }, z.core.$loose>>;
2593
+ uncheckedCount: z.ZodNumber;
2594
+ page: z.ZodObject<{
2595
+ total: z.ZodNumber;
2596
+ offset: z.ZodNumber;
2597
+ limit: z.ZodNumber;
2598
+ }, z.core.$loose>;
2599
+ user: z.ZodObject<{
2600
+ name: z.ZodString;
2601
+ role: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
2602
+ guest: "guest";
2603
+ owner: "owner";
2604
+ admin: "admin";
2605
+ member: "member";
2606
+ }>>>;
2607
+ }, z.core.$loose>;
2608
+ kind: z.ZodLiteral<"human">;
2609
+ }, z.core.$loose>], "kind">;
2564
2610
  declare const agentApiMentionActionsPendingQuerySchema: z.ZodObject<{
2565
2611
  limit: z.ZodOptional<z.ZodString>;
2566
2612
  }, z.core.$loose>;
@@ -5731,6 +5777,77 @@ declare const agentApiContract: {
5731
5777
  } & {
5732
5778
  fullPath: string;
5733
5779
  };
5780
+ readonly userChannels: {
5781
+ readonly key: "userChannels";
5782
+ readonly method: "GET";
5783
+ readonly path: "/users/:name/channels";
5784
+ readonly client: {
5785
+ readonly resource: "users";
5786
+ readonly method: "channels";
5787
+ };
5788
+ readonly capability: "channels";
5789
+ readonly description: "One visible agent or human (exact name, agents first; the serverInfo entry) and which of one window of your visible channels (serverInfo order, offset/limit, limit at most 200) list them as a member, in one request. Needs the read capability as well. 404 user_not_found when no visible user has that name.";
5790
+ readonly request: {
5791
+ readonly params: z.ZodObject<{
5792
+ name: z.ZodString;
5793
+ }, z.core.$loose>;
5794
+ readonly query: z.ZodObject<{
5795
+ offset: z.ZodOptional<z.ZodString>;
5796
+ limit: z.ZodOptional<z.ZodString>;
5797
+ }, z.core.$loose>;
5798
+ };
5799
+ readonly response: {
5800
+ readonly body: z.ZodDiscriminatedUnion<[z.ZodObject<{
5801
+ memberships: z.ZodArray<z.ZodObject<{
5802
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<ChannelId, string>>;
5803
+ name: z.ZodString;
5804
+ joined: z.ZodBoolean;
5805
+ }, z.core.$loose>>;
5806
+ uncheckedCount: z.ZodNumber;
5807
+ page: z.ZodObject<{
5808
+ total: z.ZodNumber;
5809
+ offset: z.ZodNumber;
5810
+ limit: z.ZodNumber;
5811
+ }, z.core.$loose>;
5812
+ user: z.ZodObject<{
5813
+ name: z.ZodString;
5814
+ status: z.ZodOptional<z.ZodString>;
5815
+ activity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5816
+ activityDetail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5817
+ role: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
5818
+ owner: "owner";
5819
+ admin: "admin";
5820
+ member: "member";
5821
+ }>>>;
5822
+ }, z.core.$loose>;
5823
+ kind: z.ZodLiteral<"agent">;
5824
+ }, z.core.$loose>, z.ZodObject<{
5825
+ memberships: z.ZodArray<z.ZodObject<{
5826
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<ChannelId, string>>;
5827
+ name: z.ZodString;
5828
+ joined: z.ZodBoolean;
5829
+ }, z.core.$loose>>;
5830
+ uncheckedCount: z.ZodNumber;
5831
+ page: z.ZodObject<{
5832
+ total: z.ZodNumber;
5833
+ offset: z.ZodNumber;
5834
+ limit: z.ZodNumber;
5835
+ }, z.core.$loose>;
5836
+ user: z.ZodObject<{
5837
+ name: z.ZodString;
5838
+ role: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
5839
+ guest: "guest";
5840
+ owner: "owner";
5841
+ admin: "admin";
5842
+ member: "member";
5843
+ }>>>;
5844
+ }, z.core.$loose>;
5845
+ kind: z.ZodLiteral<"human">;
5846
+ }, z.core.$loose>], "kind">;
5847
+ };
5848
+ } & {
5849
+ fullPath: string;
5850
+ };
5734
5851
  readonly serverUpdate: {
5735
5852
  readonly key: "serverUpdate";
5736
5853
  readonly method: "PATCH";
@@ -8740,6 +8857,9 @@ type AgentApiOkResponse = z.infer<typeof agentApiOkResponseSchema>;
8740
8857
  type AgentApiActionPrepareResponse = z.infer<typeof agentApiActionPrepareResponseSchema>;
8741
8858
  type AgentApiAgentContextResponse = z.infer<typeof agentApiAgentContextResponseSchema>;
8742
8859
  type AgentApiServerInfoResponse = z.infer<typeof agentApiServerInfoResponseSchema>;
8860
+ type AgentApiUserChannelsParams = z.infer<typeof agentApiUserChannelsParamsSchema>;
8861
+ type AgentApiUserChannelsQuery = z.infer<typeof agentApiUserChannelsQuerySchema>;
8862
+ type AgentApiUserChannelsResponse = z.infer<typeof agentApiUserChannelsResponseSchema>;
8743
8863
  type AgentApiServerUpdateBody = z.infer<typeof agentApiServerUpdateBodySchema>;
8744
8864
  type AgentApiServerUpdateResponse = z.infer<typeof agentApiServerUpdateResponseSchema>;
8745
8865
  type AgentApiMentionActionsPendingQuery = z.infer<typeof agentApiMentionActionsPendingQuerySchema>;
@@ -8806,6 +8926,7 @@ type AgentApiRequestParamsByRoute = {
8806
8926
  inboxList: never;
8807
8927
  agentContext: never;
8808
8928
  serverInfo: never;
8929
+ userChannels: AgentApiUserChannelsParams;
8809
8930
  serverUpdate: never;
8810
8931
  mentionActionsPending: never;
8811
8932
  senderMentionDeliveries: AgentApiSenderMentionDeliveriesParams;
@@ -8887,6 +9008,7 @@ type AgentApiRequestQueryByRoute = {
8887
9008
  inboxList: AgentApiInboxListQuery;
8888
9009
  agentContext: never;
8889
9010
  serverInfo: never;
9011
+ userChannels: AgentApiUserChannelsQuery;
8890
9012
  serverUpdate: never;
8891
9013
  mentionActionsPending: AgentApiMentionActionsPendingQuery;
8892
9014
  senderMentionDeliveries: never;
@@ -8968,6 +9090,7 @@ type AgentApiRequestBodyByRoute = {
8968
9090
  inboxList: never;
8969
9091
  agentContext: never;
8970
9092
  serverInfo: never;
9093
+ userChannels: never;
8971
9094
  serverUpdate: AgentApiServerUpdateBody;
8972
9095
  mentionActionsPending: never;
8973
9096
  senderMentionDeliveries: never;
@@ -9049,6 +9172,7 @@ type AgentApiResponseByRoute = {
9049
9172
  inboxList: AgentApiInboxListResponse;
9050
9173
  agentContext: AgentApiAgentContextResponse;
9051
9174
  serverInfo: AgentApiServerInfoResponse;
9175
+ userChannels: AgentApiUserChannelsResponse;
9052
9176
  serverUpdate: AgentApiServerUpdateResponse;
9053
9177
  mentionActionsPending: AgentApiMentionActionsPendingResponse;
9054
9178
  senderMentionDeliveries: AgentApiSenderMentionDeliveriesResponse;
@@ -9973,42 +10097,6 @@ declare const OPERATION_DEFS: readonly [{
9973
10097
  mayBeLarge: false;
9974
10098
  boundBy: never[];
9975
10099
  };
9976
- }, {
9977
- readonly name: "mentions.execute";
9978
- readonly description: "Deprecated: use mentions.notify / mentions.add. Removed in the next minor release. Deliver unreached @mentions: notify the mentioned target, or add them to the conversation.";
9979
- readonly schema: z.ZodObject<{
9980
- action: z.ZodEnum<{
9981
- notify: "notify";
9982
- add: "add";
9983
- }>;
9984
- resolutionIds: z.ZodArray<z.ZodString>;
9985
- }, z.core.$strip>;
9986
- readonly routes: readonly ["mentionActionsExecute"];
9987
- readonly consumes: {
9988
- model: never[];
9989
- code: never[];
9990
- };
9991
- readonly output: {
9992
- mayBeLarge: false;
9993
- boundBy: never[];
9994
- };
9995
- readonly deprecated: true;
9996
- }, {
9997
- readonly name: "mentions.deliveries";
9998
- readonly description: "Deprecated: use mentions.delivery. Removed in the next minor release. Whether each @mention in a message you sent reached its target.";
9999
- readonly schema: z.ZodObject<{
10000
- messageId: z.ZodString;
10001
- }, z.core.$strip>;
10002
- readonly routes: readonly ["senderMentionDeliveries"];
10003
- readonly consumes: {
10004
- model: never[];
10005
- code: never[];
10006
- };
10007
- readonly output: {
10008
- mayBeLarge: false;
10009
- boundBy: never[];
10010
- };
10011
- readonly deprecated: true;
10012
10100
  }, {
10013
10101
  readonly name: "actions.prepare";
10014
10102
  readonly description: "Post an action card (create a channel, add members, create an agent, or an integration step) for a human to confirm; the human who clicks it carries it out as themselves. When it is executed (or fails), the outcome arrives as a reply that @mentions you in the card's thread (or in the thread the card was posted in).";
@@ -10514,7 +10602,7 @@ declare const OPERATION_DEFS: readonly [{
10514
10602
  offset: z.ZodOptional<z.ZodNumber>;
10515
10603
  limit: z.ZodOptional<z.ZodNumber>;
10516
10604
  }, z.core.$strip>;
10517
- readonly routes: readonly ["serverInfo", "channelMembers"];
10605
+ readonly routes: readonly ["userChannels", "serverInfo"];
10518
10606
  readonly consumes: {
10519
10607
  model: never[];
10520
10608
  code: never[];
@@ -10753,12 +10841,6 @@ interface Raft {
10753
10841
  delivery(request: {
10754
10842
  messageId: string;
10755
10843
  }): Promise<RaftOutcome<AgentApiSenderMentionDeliveriesResponse, "deliveries" | "empty">>;
10756
- /** @deprecated Use `mentions.notify` / `mentions.add`; removed in 0.12.0. */
10757
- execute(request: ExecuteMentionActionRequest): Promise<RaftMentionActionOutcome>;
10758
- /** @deprecated Use `mentions.delivery`; removed in 0.12.0. */
10759
- deliveries(request: {
10760
- messageId: string;
10761
- }): Promise<RaftOutcome<AgentApiSenderMentionDeliveriesResponse, "deliveries" | "empty">>;
10762
10844
  };
10763
10845
  actions: {
10764
10846
  /**
@@ -10893,4 +10975,4 @@ export declare const commitInboxRequestSchema: z.ZodObject<{
10893
10975
  cursor: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
10894
10976
  }, z.core.$strip>;
10895
10977
  //#endregion
10896
- export type { AmendTaskOutcome, AmendTaskRequest, AssignTaskRequest, BootstrapRaftCredentialOptions, CheckInboxOutcome, CheckInboxRequest, ClaimTasksOutcome, ClaimTasksRequest, ConvertMessageToTaskRequest, CreateRaftClientFromStoreOptions, CreateRaftClientOptions, CreateRaftOptions, CreateRaftRoutesOptions, CreateTasksRequest, DrainInboxRequest, ExecuteMentionActionRequest, ListInboxRequest, ListTasksRequest, ManualContext, MentionResolutionIdsRequest, PrepareActionCardRequest, Raft, RaftAckMode, RaftActionPrepareRequest, RaftActionPrepared, RaftApiError, RaftApiResult, RaftAppConfig, RaftAppConfigPatch, RaftAttachmentBytes, RaftAttachmentDownloadUrl, RaftAttachmentUploaded, RaftAvatarUpload, RaftChannelInfo, RaftChannelJoinClient, RaftChannelJoinClientResult, RaftChannelJoinError, RaftChannelJoinFailure, RaftChannelJoinOperation, RaftChannelJoinRequest, RaftChannelJoinResult, RaftChannelJoinSuccess, RaftChannelJoinTransportError, RaftChannelMuteState, RaftChannelRef, RaftClaimResult, RaftClaimRow, RaftClaimRowState, RaftClient, RaftClientError, RaftClientFailure, RaftClientResult, RaftClientSuccess, RaftClientThrottleOptions, RaftClientTransportRequest, RaftConsumption, RaftContextAgent, RaftContextData, RaftContextError, RaftContextResult, RaftContextServer, RaftCredentialErrorCode, RaftCredentialIdentity, RaftCredentialStore, RaftEvent, RaftEventAttachment, RaftEventExternalMessage, RaftEventsReceiveData, RaftEventsReceiveError, RaftEventsReceiveRequest, RaftEventsReceiveResult, RaftFailure, RaftHintStyle, RaftHistoryPage, RaftInboxBatch, RaftInboxCommitResult, RaftInboxConversation, RaftInboxDrainSummary, RaftInboxDrained, RaftInboxListing, RaftInboxNotice, RaftInterrupt, RaftInterruptCancel, RaftInterruptReason, RaftInterruptResume, RaftInterrupted, RaftInvokeCaller, RaftInvokeResult, RaftJsonSchema, RaftJsonSchemaType, RaftLatestReadThread, RaftManageClient, RaftMentionActionOutcome, RaftMessage, RaftMessageAttachment, RaftMessageTask, RaftNextOperation, RaftNextStep, RaftNoticeFlag, RaftNoticeTarget, RaftOpError, RaftOpErrorCode, RaftOperationIdempotency, RaftOperationName, RaftOperationSpec, RaftOperationsDocument, RaftOutcome, RaftPendingMentions, RaftPreparedCard, RaftProfile, RaftProfileUpdate, RaftRouteAnnotations, RaftRouteInfo, RaftRouteKey, RaftRouteMeta, RaftRouteResult, RaftRouteRetryPolicy, RaftRoutes, RaftSdkConfigurationErrorCode, RaftSearchPage, RaftSenderType, RaftSent, RaftServerInfo, RaftServerProfile, RaftServerUpdate, RaftState, RaftStateContinuation, RaftStateSaveErrorHandler, RaftStateStore, RaftTaskBoard, RaftTaskStatus, RaftTasksCreated, RaftUserInfo, RaftUserRef, RaftWebhookStatus, ReactRequest, ReadHistoryRequest, ReadLatestReadThreadOptions, ReplyToRequest, SearchMessagesRequest, SeenAttestation, SeenFrontierSnapshot, SendMessageOutcome, SendMessageRequest, ServerInfoRequest, ServerInfoSection, StoredRaftCredential, TaskRef, UpdateTaskStatusOutcome, UpdateTaskStatusRequest, UploadAttachmentRequest, UserInfoRequest, VerifyNoticeInput, VerifyNoticeRejection, VerifyNoticeResult };
10978
+ export type { AmendTaskOutcome, AmendTaskRequest, AssignTaskRequest, BootstrapRaftCredentialOptions, CheckInboxOutcome, CheckInboxRequest, ClaimTasksOutcome, ClaimTasksRequest, ConvertMessageToTaskRequest, CreateRaftClientFromStoreOptions, CreateRaftClientOptions, CreateRaftOptions, CreateRaftRoutesOptions, CreateTasksRequest, DrainInboxRequest, ListInboxRequest, ListTasksRequest, ManualContext, MentionResolutionIdsRequest, PrepareActionCardRequest, Raft, RaftAckMode, RaftActionPrepareRequest, RaftActionPrepared, RaftApiError, RaftApiResult, RaftAppConfig, RaftAppConfigPatch, RaftAttachmentBytes, RaftAttachmentDownloadUrl, RaftAttachmentUploaded, RaftAvatarUpload, RaftChannelInfo, RaftChannelJoinClient, RaftChannelJoinClientResult, RaftChannelJoinError, RaftChannelJoinFailure, RaftChannelJoinOperation, RaftChannelJoinRequest, RaftChannelJoinResult, RaftChannelJoinSuccess, RaftChannelJoinTransportError, RaftChannelMuteState, RaftChannelRef, RaftClaimResult, RaftClaimRow, RaftClaimRowState, RaftClient, RaftClientError, RaftClientFailure, RaftClientResult, RaftClientSuccess, RaftClientThrottleOptions, RaftClientTransportRequest, RaftConsumption, RaftContextAgent, RaftContextData, RaftContextError, RaftContextResult, RaftContextServer, RaftCredentialErrorCode, RaftCredentialIdentity, RaftCredentialStore, RaftEvent, RaftEventAttachment, RaftEventExternalMessage, RaftEventsReceiveData, RaftEventsReceiveError, RaftEventsReceiveRequest, RaftEventsReceiveResult, RaftFailure, RaftHintStyle, RaftHistoryPage, RaftInboxBatch, RaftInboxCommitResult, RaftInboxConversation, RaftInboxDrainSummary, RaftInboxDrained, RaftInboxListing, RaftInboxNotice, RaftInterrupt, RaftInterruptCancel, RaftInterruptReason, RaftInterruptResume, RaftInterrupted, RaftInvokeCaller, RaftInvokeResult, RaftJsonSchema, RaftJsonSchemaType, RaftLatestReadThread, RaftManageClient, RaftMentionActionOutcome, RaftMessage, RaftMessageAttachment, RaftMessageTask, RaftNextOperation, RaftNextStep, RaftNoticeFlag, RaftNoticeTarget, RaftOpError, RaftOpErrorCode, RaftOperationIdempotency, RaftOperationName, RaftOperationSpec, RaftOperationsDocument, RaftOutcome, RaftPendingMentions, RaftPreparedCard, RaftProfile, RaftProfileUpdate, RaftRouteAnnotations, RaftRouteInfo, RaftRouteKey, RaftRouteMeta, RaftRouteResult, RaftRouteRetryPolicy, RaftRoutes, RaftSdkConfigurationErrorCode, RaftSearchPage, RaftSenderType, RaftSent, RaftServerInfo, RaftServerProfile, RaftServerUpdate, RaftState, RaftStateContinuation, RaftStateSaveErrorHandler, RaftStateStore, RaftTaskBoard, RaftTaskStatus, RaftTasksCreated, RaftUserInfo, RaftUserRef, RaftWebhookStatus, ReactRequest, ReadHistoryRequest, ReadLatestReadThreadOptions, ReplyToRequest, SearchMessagesRequest, SeenAttestation, SeenFrontierSnapshot, SendMessageOutcome, SendMessageRequest, ServerInfoRequest, ServerInfoSection, StoredRaftCredential, TaskRef, UpdateTaskStatusOutcome, UpdateTaskStatusRequest, UploadAttachmentRequest, UserInfoRequest, VerifyNoticeInput, VerifyNoticeRejection, VerifyNoticeResult };
package/operations.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema": "raft-sdk-operations.v1",
3
- "version": "16c7523f47f8b204",
3
+ "version": "24580df5e6c5b3bc",
4
4
  "operations": [
5
5
  {
6
6
  "name": "identity.whoami",
@@ -837,88 +837,6 @@
837
837
  "boundBy": []
838
838
  }
839
839
  },
840
- {
841
- "name": "mentions.execute",
842
- "toolName": "mentions_execute",
843
- "description": "Deprecated: use mentions.notify / mentions.add. Removed in the next minor release. Deliver unreached @mentions: notify the mentioned target, or add them to the conversation.",
844
- "inputSchema": {
845
- "type": "object",
846
- "properties": {
847
- "action": {
848
- "type": "string",
849
- "description": "notify: tell the mentioned target about the message; add: add them to the conversation.",
850
- "enum": [
851
- "notify",
852
- "add"
853
- ]
854
- },
855
- "resolutionIds": {
856
- "type": "array",
857
- "description": "resolutionId values from mentions.pending.",
858
- "items": {
859
- "type": "string"
860
- }
861
- }
862
- },
863
- "required": [
864
- "action",
865
- "resolutionIds"
866
- ]
867
- },
868
- "sideEffect": "write",
869
- "idempotency": {
870
- "kind": "none"
871
- },
872
- "capability": [
873
- "mentions"
874
- ],
875
- "modelOnly": false,
876
- "mayInterrupt": false,
877
- "consumes": {
878
- "model": [],
879
- "code": []
880
- },
881
- "output": {
882
- "mayBeLarge": false,
883
- "boundBy": []
884
- },
885
- "deprecated": true
886
- },
887
- {
888
- "name": "mentions.deliveries",
889
- "toolName": "mentions_deliveries",
890
- "description": "Deprecated: use mentions.delivery. Removed in the next minor release. Whether each @mention in a message you sent reached its target.",
891
- "inputSchema": {
892
- "type": "object",
893
- "properties": {
894
- "messageId": {
895
- "type": "string",
896
- "description": "Id of a message you sent."
897
- }
898
- },
899
- "required": [
900
- "messageId"
901
- ]
902
- },
903
- "sideEffect": "read",
904
- "idempotency": {
905
- "kind": "natural"
906
- },
907
- "capability": [
908
- "mentions"
909
- ],
910
- "modelOnly": false,
911
- "mayInterrupt": false,
912
- "consumes": {
913
- "model": [],
914
- "code": []
915
- },
916
- "output": {
917
- "mayBeLarge": false,
918
- "boundBy": []
919
- },
920
- "deprecated": true
921
- },
922
840
  {
923
841
  "name": "actions.prepare",
924
842
  "toolName": "actions_prepare",
@@ -2141,8 +2059,9 @@
2141
2059
  },
2142
2060
  "limit": {
2143
2061
  "type": "integer",
2144
- "description": "Membership paging: visible channels to inspect (default 50).",
2145
- "minimum": 1
2062
+ "description": "Membership paging: visible channels to inspect (default 50, at most 200).",
2063
+ "minimum": 1,
2064
+ "maximum": 200
2146
2065
  }
2147
2066
  },
2148
2067
  "required": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botiverse/raft-sdk",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "license": "FSL-1.1-ALv2",
5
5
  "description": "Typed Raft Agent API client for external agents and bots.",
6
6
  "type": "module",