@aeolus-fleet/gateway 0.0.0 → 0.28.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.
Files changed (171) hide show
  1. package/README.md +11 -10
  2. package/dist/adapters/crypto/page-sessions.d.ts +15 -0
  3. package/dist/adapters/crypto/page-sessions.js +40 -0
  4. package/dist/adapters/crypto/page-sessions.js.map +1 -0
  5. package/dist/adapters/crypto/request-ids.d.ts +1 -1
  6. package/dist/adapters/crypto/request-ids.js +2 -9
  7. package/dist/adapters/crypto/request-ids.js.map +1 -1
  8. package/dist/adapters/crypto/sign-in-seals.d.ts +1 -1
  9. package/dist/adapters/crypto/sign-in-seals.js +7 -9
  10. package/dist/adapters/crypto/sign-in-seals.js.map +1 -1
  11. package/dist/adapters/fleet/actor-door.d.ts +20 -0
  12. package/dist/adapters/fleet/actor-door.js +75 -0
  13. package/dist/adapters/fleet/actor-door.js.map +1 -0
  14. package/dist/adapters/fleet/core-version.d.ts +8 -8
  15. package/dist/adapters/fleet/core-version.js +6 -47
  16. package/dist/adapters/fleet/core-version.js.map +1 -1
  17. package/dist/adapters/fleet/fleet-network.js +7 -17
  18. package/dist/adapters/fleet/fleet-network.js.map +1 -1
  19. package/dist/adapters/fleet/logged-verified-facts.d.ts +13 -0
  20. package/dist/adapters/fleet/logged-verified-facts.js +18 -0
  21. package/dist/adapters/fleet/logged-verified-facts.js.map +1 -0
  22. package/dist/adapters/fleet/proxy-ship-reads.d.ts +7 -0
  23. package/dist/adapters/fleet/proxy-ship-reads.js +24 -0
  24. package/dist/adapters/fleet/proxy-ship-reads.js.map +1 -0
  25. package/dist/adapters/fleet/proxy-ships-as-actor.d.ts +3 -0
  26. package/dist/adapters/fleet/proxy-ships-as-actor.js +25 -0
  27. package/dist/adapters/fleet/proxy-ships-as-actor.js.map +1 -0
  28. package/dist/adapters/fleet/rest-fleet-door.d.ts +2 -2
  29. package/dist/adapters/fleet/rest-fleet-door.js +23 -7
  30. package/dist/adapters/fleet/rest-fleet-door.js.map +1 -1
  31. package/dist/adapters/http/add-server-page.d.ts +7 -0
  32. package/dist/adapters/http/add-server-page.js +175 -0
  33. package/dist/adapters/http/add-server-page.js.map +1 -0
  34. package/dist/adapters/http/delivery-page.d.ts +24 -0
  35. package/dist/adapters/http/delivery-page.js +115 -0
  36. package/dist/adapters/http/delivery-page.js.map +1 -0
  37. package/dist/adapters/http/oauth-routes.d.ts +15 -3
  38. package/dist/adapters/http/oauth-routes.js +33 -1
  39. package/dist/adapters/http/oauth-routes.js.map +1 -1
  40. package/dist/adapters/http/outside-parties-page.d.ts +29 -2
  41. package/dist/adapters/http/outside-parties-page.js +15 -11
  42. package/dist/adapters/http/outside-parties-page.js.map +1 -1
  43. package/dist/adapters/http/outside-party-page.d.ts +7 -0
  44. package/dist/adapters/http/outside-party-page.js +212 -0
  45. package/dist/adapters/http/outside-party-page.js.map +1 -0
  46. package/dist/adapters/http/overview-page.d.ts +2 -1
  47. package/dist/adapters/http/overview-page.js +79 -36
  48. package/dist/adapters/http/overview-page.js.map +1 -1
  49. package/dist/adapters/http/parties-page.d.ts +2 -1
  50. package/dist/adapters/http/parties-page.js +8 -10
  51. package/dist/adapters/http/parties-page.js.map +1 -1
  52. package/dist/adapters/http/scope-rows.d.ts +10 -0
  53. package/dist/adapters/http/scope-rows.js +30 -0
  54. package/dist/adapters/http/scope-rows.js.map +1 -0
  55. package/dist/adapters/http/signal.d.ts +10 -1
  56. package/dist/adapters/http/signal.js +50 -7
  57. package/dist/adapters/http/signal.js.map +1 -1
  58. package/dist/adapters/pagasae/pagasae-client.js +7 -9
  59. package/dist/adapters/pagasae/pagasae-client.js.map +1 -1
  60. package/dist/adapters/prisma/account-grants.js +2 -2
  61. package/dist/adapters/prisma/account-grants.js.map +1 -1
  62. package/dist/adapters/prisma/client-calls.js +9 -0
  63. package/dist/adapters/prisma/client-calls.js.map +1 -1
  64. package/dist/adapters/prisma/generated/internal/class.js +4 -4
  65. package/dist/adapters/prisma/generated/internal/class.js.map +1 -1
  66. package/dist/adapters/prisma/generated/internal/prismaNamespace.d.ts +1 -1
  67. package/dist/adapters/prisma/generated/internal/prismaNamespace.js +1 -1
  68. package/dist/adapters/prisma/generated/internal/prismaNamespace.js.map +1 -1
  69. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.d.ts +1 -1
  70. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js +1 -1
  71. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js.map +1 -1
  72. package/dist/adapters/prisma/generated/models/AccountGrant.d.ts +33 -1
  73. package/dist/adapters/prisma/generated/models/ClientCall.d.ts +14 -14
  74. package/dist/adapters/prisma/generated/models/Party.d.ts +1 -29
  75. package/dist/adapters/prisma/oauth-stores.js +3 -0
  76. package/dist/adapters/prisma/oauth-stores.js.map +1 -1
  77. package/dist/adapters/prisma/party-store.js +0 -2
  78. package/dist/adapters/prisma/party-store.js.map +1 -1
  79. package/dist/adapters/prisma/pending-requests.js +7 -1
  80. package/dist/adapters/prisma/pending-requests.js.map +1 -1
  81. package/dist/adapters/trpc/router.d.ts +210 -12
  82. package/dist/adapters/trpc/router.js +159 -7
  83. package/dist/adapters/trpc/router.js.map +1 -1
  84. package/dist/app.js +65 -19
  85. package/dist/app.js.map +1 -1
  86. package/dist/core/actors/authenticate-actor.d.ts +21 -5
  87. package/dist/core/actors/authenticate-actor.js +14 -2
  88. package/dist/core/actors/authenticate-actor.js.map +1 -1
  89. package/dist/core/actors/credential-of.d.ts +27 -0
  90. package/dist/core/actors/credential-of.js +25 -0
  91. package/dist/core/actors/credential-of.js.map +1 -0
  92. package/dist/core/connection/connect.js +5 -4
  93. package/dist/core/connection/connect.js.map +1 -1
  94. package/dist/core/connection/ports.d.ts +6 -1
  95. package/dist/core/mcp-in/call-tool.d.ts +6 -6
  96. package/dist/core/mcp-in/call-tool.js +3 -3
  97. package/dist/core/mcp-in/call-tool.js.map +1 -1
  98. package/dist/core/mcp-in/client-call.d.ts +2 -2
  99. package/dist/core/mcp-in/client-call.js +2 -2
  100. package/dist/core/mcp-in/client-call.js.map +1 -1
  101. package/dist/core/mcp-in/collect-replies.d.ts +4 -11
  102. package/dist/core/mcp-in/collect-replies.js +52 -30
  103. package/dist/core/mcp-in/collect-replies.js.map +1 -1
  104. package/dist/core/mcp-in/list-tools.d.ts +4 -0
  105. package/dist/core/mcp-in/list-tools.js +1 -1
  106. package/dist/core/mcp-in/list-tools.js.map +1 -1
  107. package/dist/core/mcp-in/ports.d.ts +24 -1
  108. package/dist/core/mcp-out/hand-call.d.ts +2 -0
  109. package/dist/core/mcp-out/hand-call.js +4 -2
  110. package/dist/core/mcp-out/hand-call.js.map +1 -1
  111. package/dist/core/mcp-out/state-party.d.ts +2 -1
  112. package/dist/core/mcp-out/state-party.js +1 -1
  113. package/dist/core/mcp-out/state-party.js.map +1 -1
  114. package/dist/core/mcp-out/statement.d.ts +10 -0
  115. package/dist/core/mcp-out/statement.js +7 -5
  116. package/dist/core/mcp-out/statement.js.map +1 -1
  117. package/dist/core/oauth/ports.d.ts +2 -0
  118. package/dist/core/outside-parties/ports.d.ts +1 -5
  119. package/dist/core/outside-parties/set-outside-parties.d.ts +5 -3
  120. package/dist/core/outside-parties/set-outside-parties.js +6 -2
  121. package/dist/core/outside-parties/set-outside-parties.js.map +1 -1
  122. package/dist/core/parties/approve-party.js +24 -8
  123. package/dist/core/parties/approve-party.js.map +1 -1
  124. package/dist/core/parties/change-party.d.ts +42 -0
  125. package/dist/core/parties/change-party.js +49 -0
  126. package/dist/core/parties/change-party.js.map +1 -0
  127. package/dist/core/parties/check-server.d.ts +24 -0
  128. package/dist/core/parties/check-server.js +21 -0
  129. package/dist/core/parties/check-server.js.map +1 -0
  130. package/dist/core/parties/list-parties.d.ts +28 -7
  131. package/dist/core/parties/list-parties.js +35 -4
  132. package/dist/core/parties/list-parties.js.map +1 -1
  133. package/dist/core/parties/party.d.ts +12 -6
  134. package/dist/core/parties/party.js +23 -1
  135. package/dist/core/parties/party.js.map +1 -1
  136. package/dist/core/parties/ports.d.ts +36 -1
  137. package/dist/core/parties/read-party-tools.d.ts +22 -0
  138. package/dist/core/parties/read-party-tools.js +22 -0
  139. package/dist/core/parties/read-party-tools.js.map +1 -0
  140. package/dist/core/parties/retire-party.d.ts +29 -0
  141. package/dist/core/parties/retire-party.js +43 -0
  142. package/dist/core/parties/retire-party.js.map +1 -0
  143. package/dist/core/parties/shown-party.d.ts +8 -2
  144. package/dist/core/parties/shown-party.js +3 -3
  145. package/dist/core/parties/shown-party.js.map +1 -1
  146. package/dist/core/requests/decide-request.js +9 -1
  147. package/dist/core/requests/decide-request.js.map +1 -1
  148. package/dist/core/requests/list-mine.d.ts +16 -0
  149. package/dist/core/requests/list-mine.js +20 -0
  150. package/dist/core/requests/list-mine.js.map +1 -0
  151. package/dist/core/requests/ports.d.ts +5 -0
  152. package/dist/core/shared/errors.d.ts +1 -1
  153. package/dist/core/shared/errors.js.map +1 -1
  154. package/dist/core/sign-in/account-token.d.ts +8 -4
  155. package/dist/core/sign-in/account-token.js +4 -4
  156. package/dist/core/sign-in/account-token.js.map +1 -1
  157. package/dist/core/sign-in/complete-sign-in.d.ts +15 -4
  158. package/dist/core/sign-in/complete-sign-in.js +27 -4
  159. package/dist/core/sign-in/complete-sign-in.js.map +1 -1
  160. package/dist/core/sign-in/ports.d.ts +37 -7
  161. package/dist/core/sign-in/sign-out.d.ts +10 -0
  162. package/dist/core/sign-in/sign-out.js +9 -0
  163. package/dist/core/sign-in/sign-out.js.map +1 -0
  164. package/dist/core/sign-in/start-page-sign-in.d.ts +25 -0
  165. package/dist/core/sign-in/start-page-sign-in.js +30 -0
  166. package/dist/core/sign-in/start-page-sign-in.js.map +1 -0
  167. package/package.json +3 -3
  168. package/src/adapters/prisma/migrations/20261020200000_account_grant_scopes/migration.sql +2 -0
  169. package/src/adapters/prisma/migrations/20261020210000_party_owner_from_fleet/migration.sql +2 -0
  170. package/src/adapters/prisma/migrations/20261020220000_client_call_deadline_optional/migration.sql +2 -0
  171. package/src/adapters/prisma/schema.prisma +3 -2
@@ -1,7 +1,9 @@
1
1
  import { idSchema } from '@aeolus-fleet/common';
2
2
  import { z } from 'zod';
3
3
  const requestersSchema = z.array(z.object({ accountId: z.string(), personShipId: idSchema('ship').nullable() }));
4
- const decidedBySchema = z.union([z.object({ kind: z.literal('ship'), shipId: idSchema('ship') }), z.object({ kind: z.enum(['operator', 'viewer']) })]).nullable();
4
+ const decidedBySchema = z
5
+ .union([z.object({ kind: z.literal('ship'), shipId: idSchema('ship') }), z.object({ kind: z.literal('account'), accountId: z.string() }), z.object({ kind: z.enum(['operator', 'viewer']) })])
6
+ .nullable();
5
7
  const toldAccountIdsSchema = z.array(z.string());
6
8
  const stateSchema = z.enum(['pending', 'approving', 'approved', 'denied', 'expired']);
7
9
  /** A row as the table holds it, whether read by Prisma or by the raw insert. */
@@ -86,6 +88,10 @@ export function createPrismaPendingRequests(db) {
86
88
  const row = await db.pendingRequest.findUnique({ where: { fleetId_requestId: { fleetId, requestId } } });
87
89
  return row === null ? undefined : requestOf(row);
88
90
  },
91
+ listMine: async (fleetId, accountId) => {
92
+ const rows = await db.pendingRequest.findMany({ where: { fleetId, requesters: { array_contains: [{ accountId }] } }, orderBy: { askedAt: 'desc' } });
93
+ return rows.map(requestOf);
94
+ },
89
95
  listOpen: async (fleetId, now) => {
90
96
  const rows = await db.pendingRequest.findMany({ where: { fleetId, state: { in: ['pending', 'approving'] }, expiresAt: { gt: now } }, orderBy: { askedAt: 'asc' } });
91
97
  return rows.map(requestOf);
@@ -1 +1 @@
1
- {"version":3,"file":"pending-requests.js","sourceRoot":"","sources":["../../../src/adapters/prisma/pending-requests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MA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GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;QAClK,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,CAC/C,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;YAC3B,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;YAC7J,IAAI,OAAO,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;gBACxB,OAAO,KAAK,CAAC;YACf,CAAC;YACD,MAAM,EAAE,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;YACrG,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;KACL,CAAC;AACJ,CAAC"}
@@ -9,13 +9,22 @@ import type { AuthenticateActor } from '../../core/actors/authenticate-actor.js'
9
9
  import type { ReadOutsideParties, SetOutsideParties } from '../../core/outside-parties/set-outside-parties.js';
10
10
  import type { ApproveParty } from '../../core/parties/approve-party.js';
11
11
  import type { CrewParty } from '../../core/parties/crew-party.js';
12
- import type { ListParties } from '../../core/parties/list-parties.js';
12
+ import type { ListParties, ReadParty } from '../../core/parties/list-parties.js';
13
+ import type { RetireParty } from '../../core/parties/retire-party.js';
14
+ import type { ChangePartyOwner, ChangePartyScopes } from '../../core/parties/change-party.js';
13
15
  import type { MarkTool } from '../../core/mcp-out/mark-tool.js';
14
16
  import type { StateParty } from '../../core/mcp-out/state-party.js';
17
+ import type { CheckServer } from '../../core/parties/check-server.js';
18
+ import type { ReadPartyTools } from '../../core/parties/read-party-tools.js';
15
19
  import type { RegisterClient } from '../../core/oauth/register-client.js';
16
20
  import type { DecideRequest } from '../../core/requests/decide-request.js';
21
+ import type { ListMine } from '../../core/requests/list-mine.js';
17
22
  import type { ListToDecide } from '../../core/requests/list-to-decide.js';
18
23
  import type { EndSignIns } from '../../core/sign-in/end-sign-ins.js';
24
+ import type { AnswerDelivery } from '../../core/people/answer-delivery.js';
25
+ import type { DoneDelivery } from '../../core/people/done-delivery.js';
26
+ import type { OpenDelivery } from '../../core/people/open-delivery.js';
27
+ import type { ReadInbox } from '../../core/people/read-inbox.js';
19
28
  export interface Context {
20
29
  /** The Cookie header the console's server or the gateway's page forwarded. */
21
30
  cookie: string | undefined;
@@ -40,11 +49,25 @@ export interface Context {
40
49
  approveParty: ApproveParty;
41
50
  crewParty: CrewParty;
42
51
  listParties: ListParties;
52
+ retireParty: RetireParty;
53
+ changePartyOwner: ChangePartyOwner;
54
+ changePartyScopes: ChangePartyScopes;
55
+ readParty: ReadParty;
56
+ checkServer: CheckServer;
57
+ readPartyTools: ReadPartyTools;
43
58
  stateParty: StateParty;
44
59
  markTool: MarkTool;
45
60
  registerClient: RegisterClient;
46
61
  listToDecide: ListToDecide;
62
+ listMine: ListMine;
47
63
  decideRequest: DecideRequest;
64
+ /** A person's own person ship's deliveries; unset where no pagasae signs anyone in. */
65
+ person?: {
66
+ readInbox: ReadInbox;
67
+ openDelivery: OpenDelivery;
68
+ answerDelivery: AnswerDelivery;
69
+ doneDelivery: DoneDelivery;
70
+ };
48
71
  readOutsideParties: ReadOutsideParties;
49
72
  setOutsideParties: SetOutsideParties;
50
73
  }
@@ -79,8 +102,8 @@ export declare const gatewayRouter: import("@trpc/server").TRPCBuiltRouter<{
79
102
  /**
80
103
  * Connects the gateway with its ship's secret, which the console's server
81
104
  * hands over server to server: it registers with it and keeps only the
82
- * crew token. Only while not connected, while the gateway serves the
83
- * fleet, and in a fleet with a registered networking plugin (interop I-3).
105
+ * crew token. Only while not connected, and while the gateway serves the
106
+ * fleet.
84
107
  */
85
108
  connect: import("@trpc/server").TRPCMutationProcedure<{
86
109
  input: {
@@ -105,7 +128,7 @@ export declare const gatewayRouter: import("@trpc/server").TRPCBuiltRouter<{
105
128
  errorShape: import("@trpc/server").TRPCDefaultErrorShape;
106
129
  transformer: false;
107
130
  }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
108
- /** The parties argo approved for its fleet, by name. A viewer reads them too. */
131
+ /** The fleet's outside parties, by name, each with its proxy ship's owner and scopes from the fleet, read as the actor. Any actor reads them. */
109
132
  list: import("@trpc/server").TRPCQueryProcedure<{
110
133
  input: void;
111
134
  output: ({
@@ -113,20 +136,89 @@ export declare const gatewayRouter: import("@trpc/server").TRPCBuiltRouter<{
113
136
  url: string;
114
137
  credentialKind: "bearer" | "clientCredentials";
115
138
  concurrencyLimit: number;
139
+ ownerShipId: string | null;
140
+ scopes: string[] | null;
116
141
  name: string;
117
- ownerShipId: string;
118
142
  state: "awaitingCrew" | "crewed" | "commissioning";
119
143
  proxyShipId: string | null;
120
144
  } | {
121
145
  kind: "mcpClient";
122
146
  clientId: string;
147
+ ownerShipId: string | null;
148
+ scopes: string[] | null;
123
149
  name: string;
124
- ownerShipId: string;
125
150
  state: "awaitingCrew" | "crewed" | "commissioning";
126
151
  proxyShipId: string | null;
127
152
  })[];
128
153
  meta: object;
129
154
  }>;
155
+ /** One outside party, as the list shows it. */
156
+ get: import("@trpc/server").TRPCQueryProcedure<{
157
+ input: {
158
+ name: string;
159
+ };
160
+ output: {
161
+ kind: "mcpServer";
162
+ url: string;
163
+ credentialKind: "bearer" | "clientCredentials";
164
+ concurrencyLimit: number;
165
+ ownerShipId: string | null;
166
+ scopes: string[] | null;
167
+ name: string;
168
+ state: "awaitingCrew" | "crewed" | "commissioning";
169
+ proxyShipId: string | null;
170
+ } | {
171
+ kind: "mcpClient";
172
+ clientId: string;
173
+ ownerShipId: string | null;
174
+ scopes: string[] | null;
175
+ name: string;
176
+ state: "awaitingCrew" | "crewed" | "commissioning";
177
+ proxyShipId: string | null;
178
+ };
179
+ meta: object;
180
+ }>;
181
+ /** An outside MCP server's tools, as the server lists them now, asked with the credential the gateway keeps. Any actor reads them. */
182
+ tools: import("@trpc/server").TRPCQueryProcedure<{
183
+ input: {
184
+ name: string;
185
+ };
186
+ output: {
187
+ tools: {
188
+ name: string;
189
+ description?: string | undefined;
190
+ }[];
191
+ };
192
+ meta: object;
193
+ }>;
194
+ /**
195
+ * An actor holding fleet:manage checks an outside MCP server before
196
+ * approving it (F10): the tools it lists with the credential sent. The
197
+ * gateway keeps nothing and commissions nothing. A mutation, so the
198
+ * credential travels in the body, never in a URL.
199
+ */
200
+ check: import("@trpc/server").TRPCMutationProcedure<{
201
+ input: {
202
+ url: string;
203
+ credential: {
204
+ kind: "bearer";
205
+ token: string;
206
+ } | {
207
+ kind: "clientCredentials";
208
+ clientId: string;
209
+ clientSecret: string;
210
+ issuer: string;
211
+ scope?: string | undefined;
212
+ };
213
+ };
214
+ output: {
215
+ tools: {
216
+ name: string;
217
+ description?: string | undefined;
218
+ }[];
219
+ };
220
+ meta: object;
221
+ }>;
130
222
  /**
131
223
  * argo approves an outside MCP server as a party: the gateway commissions
132
224
  * its app proxy ship owned by the owner argo picked, crews it, and keeps
@@ -157,19 +249,50 @@ export declare const gatewayRouter: import("@trpc/server").TRPCBuiltRouter<{
157
249
  credentialKind: "bearer" | "clientCredentials";
158
250
  concurrencyLimit: number;
159
251
  name: string;
160
- ownerShipId: string;
161
252
  state: "awaitingCrew" | "crewed" | "commissioning";
162
253
  proxyShipId: string | null;
163
254
  } | {
164
255
  kind: "mcpClient";
165
256
  clientId: string;
166
257
  name: string;
167
- ownerShipId: string;
168
258
  state: "awaitingCrew" | "crewed" | "commissioning";
169
259
  proxyShipId: string | null;
170
260
  };
171
261
  meta: object;
172
262
  }>;
263
+ /**
264
+ * An actor holding fleet:manage retires a party (decision 0056): its proxy
265
+ * ship is retired in the fleet as the actor, within its manage reach, and
266
+ * the gateway forgets the party. Adding it again is a new request.
267
+ */
268
+ /** An actor holding fleet:owner sets a party's owner: its proxy ship's, in the fleet, as the actor (decision 0056). */
269
+ changeOwner: import("@trpc/server").TRPCMutationProcedure<{
270
+ input: {
271
+ name: string;
272
+ ownerShipId: unknown;
273
+ };
274
+ output: Record<string, never>;
275
+ meta: object;
276
+ }>;
277
+ /** An actor holding scopes:grant grants and revokes a party's scopes, only scopes it holds: every scope its proxy ship holds now (decision 0056). */
278
+ changeScopes: import("@trpc/server").TRPCMutationProcedure<{
279
+ input: {
280
+ name: string;
281
+ grant: string[];
282
+ revoke: string[];
283
+ };
284
+ output: {
285
+ scopes: string[];
286
+ };
287
+ meta: object;
288
+ }>;
289
+ retire: import("@trpc/server").TRPCMutationProcedure<{
290
+ input: {
291
+ name: string;
292
+ };
293
+ output: Record<string, never>;
294
+ meta: object;
295
+ }>;
173
296
  /** argo hands over a new secret, from a new starting prompt in the console, for a proxy ship that awaits crew. */
174
297
  crew: import("@trpc/server").TRPCMutationProcedure<{
175
298
  input: {
@@ -182,14 +305,12 @@ export declare const gatewayRouter: import("@trpc/server").TRPCBuiltRouter<{
182
305
  credentialKind: "bearer" | "clientCredentials";
183
306
  concurrencyLimit: number;
184
307
  name: string;
185
- ownerShipId: string;
186
308
  state: "awaitingCrew" | "crewed" | "commissioning";
187
309
  proxyShipId: string | null;
188
310
  } | {
189
311
  kind: "mcpClient";
190
312
  clientId: string;
191
313
  name: string;
192
- ownerShipId: string;
193
314
  state: "awaitingCrew" | "crewed" | "commissioning";
194
315
  proxyShipId: string | null;
195
316
  };
@@ -218,12 +339,88 @@ export declare const gatewayRouter: import("@trpc/server").TRPCBuiltRouter<{
218
339
  meta: object;
219
340
  }>;
220
341
  }>>;
342
+ people: import("@trpc/server").TRPCBuiltRouter<{
343
+ ctx: Context;
344
+ meta: object;
345
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
346
+ transformer: false;
347
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
348
+ /** What waits for the person's own ship, by titles only (Q20). */
349
+ inbox: import("@trpc/server").TRPCQueryProcedure<{
350
+ input: void;
351
+ output: {
352
+ waiting: number;
353
+ deliveries: import("../../core/people/inbox-entry.js").InboxEntry[];
354
+ };
355
+ meta: object;
356
+ }>;
357
+ /** Opens one delivery, whole; the gateway acknowledges it for them. */
358
+ open: import("@trpc/server").TRPCMutationProcedure<{
359
+ input: {
360
+ deliveryId: string;
361
+ };
362
+ output: import("../../core/people/open-delivery.js").OpenedView;
363
+ meta: object;
364
+ }>;
365
+ /** Answers a delivery they opened, to its sender. */
366
+ answer: import("@trpc/server").TRPCMutationProcedure<{
367
+ input: {
368
+ deliveryId: string;
369
+ contentType: string;
370
+ payload: string;
371
+ };
372
+ output: import("../../core/people/opened-of.js").Dealt;
373
+ meta: object;
374
+ }>;
375
+ /** Is done with a delivery they opened, with no answer. */
376
+ done: import("@trpc/server").TRPCMutationProcedure<{
377
+ input: {
378
+ deliveryId: string;
379
+ };
380
+ output: import("../../core/people/opened-of.js").Dealt;
381
+ meta: object;
382
+ }>;
383
+ }>>;
221
384
  requests: import("@trpc/server").TRPCBuiltRouter<{
222
385
  ctx: Context;
223
386
  meta: object;
224
387
  errorShape: import("@trpc/server").TRPCDefaultErrorShape;
225
388
  transformer: false;
226
389
  }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
390
+ /** The requests the account asked, in any state, the newest first (decision 0056: Your requests). */
391
+ mine: import("@trpc/server").TRPCQueryProcedure<{
392
+ input: void;
393
+ output: {
394
+ fleetId: string;
395
+ requestId: string;
396
+ subject: {
397
+ kind: "client";
398
+ clientId: string;
399
+ clientName: string;
400
+ } | {
401
+ kind: "server";
402
+ url: string;
403
+ };
404
+ requesters: {
405
+ accountId: string;
406
+ personShipId: string | null;
407
+ }[];
408
+ askedAt: string;
409
+ expiresAt: string;
410
+ state: "pending" | "approving" | "approved" | "denied" | "expired";
411
+ decidedBy: {
412
+ kind: "ship";
413
+ shipId: string;
414
+ } | {
415
+ kind: "account";
416
+ accountId: string;
417
+ } | {
418
+ kind: "operator" | "viewer";
419
+ } | null;
420
+ decidedAt: string | null;
421
+ }[];
422
+ meta: object;
423
+ }>;
227
424
  /** Every open request of the fleet, for an actor holding gateway:approve (decision 0056). */
228
425
  toDecide: import("@trpc/server").TRPCQueryProcedure<{
229
426
  input: void;
@@ -248,6 +445,9 @@ export declare const gatewayRouter: import("@trpc/server").TRPCBuiltRouter<{
248
445
  decidedBy: {
249
446
  kind: "ship";
250
447
  shipId: string;
448
+ } | {
449
+ kind: "account";
450
+ accountId: string;
251
451
  } | {
252
452
  kind: "operator" | "viewer";
253
453
  } | null;
@@ -291,14 +491,12 @@ export declare const gatewayRouter: import("@trpc/server").TRPCBuiltRouter<{
291
491
  credentialKind: "bearer" | "clientCredentials";
292
492
  concurrencyLimit: number;
293
493
  name: string;
294
- ownerShipId: string;
295
494
  state: "awaitingCrew" | "crewed" | "commissioning";
296
495
  proxyShipId: string | null;
297
496
  } | {
298
497
  kind: "mcpClient";
299
498
  clientId: string;
300
499
  name: string;
301
- ownerShipId: string;
302
500
  state: "awaitingCrew" | "crewed" | "commissioning";
303
501
  proxyShipId: string | null;
304
502
  } | null;
@@ -92,11 +92,38 @@ const APPROVE_CODES = {
92
92
  FLEET_UNAVAILABLE: 'BAD_GATEWAY',
93
93
  };
94
94
  /** The refusals of crewing a party's proxy ship with a new secret, as the API states them. */
95
+ /** The refusals of retiring a party, as the API states them. */
96
+ /** The refusals of changing a party's owner or scopes, as the API states them. */
97
+ const CHANGE_CODES = {
98
+ SCOPE_NOT_HELD: 'FORBIDDEN',
99
+ NO_SUCH_PARTY: 'NOT_FOUND',
100
+ PARTY_NOT_COMMISSIONED: 'PRECONDITION_FAILED',
101
+ CHANGE_REFUSED: 'FORBIDDEN',
102
+ FLEET_UNAVAILABLE: 'BAD_GATEWAY',
103
+ NOT_AN_ACTOR: 'UNAUTHORIZED',
104
+ };
105
+ const RETIRE_CODES = {
106
+ NOT_A_MANAGER: 'FORBIDDEN',
107
+ NO_SUCH_PARTY: 'NOT_FOUND',
108
+ RETIRE_REFUSED: 'FORBIDDEN',
109
+ FLEET_UNAVAILABLE: 'BAD_GATEWAY',
110
+ NOT_AN_ACTOR: 'UNAUTHORIZED',
111
+ };
95
112
  const CREW_CODES = {
96
113
  NO_SUCH_PARTY: 'NOT_FOUND',
97
114
  NOT_AWAITING_CREW: 'CONFLICT',
98
115
  SECRET_REFUSED: 'BAD_REQUEST',
99
116
  };
117
+ /** The refusals of reading an outside MCP server's tools, as the API states them. */
118
+ const TOOLS_CODES = {
119
+ NO_SUCH_PARTY: 'NOT_FOUND',
120
+ SERVER_UNREACHABLE: 'BAD_GATEWAY',
121
+ };
122
+ /** The refusals of checking an outside MCP server, as the API states them. */
123
+ const CHECK_CODES = {
124
+ OUTSIDE_PARTIES_OFF: 'PRECONDITION_FAILED',
125
+ SERVER_UNREACHABLE: 'BAD_GATEWAY',
126
+ };
100
127
  /** The refusals of stating a party's proxy ship, as the API states them. */
101
128
  const STATE_CODES = {
102
129
  NO_SUCH_PARTY: 'NOT_FOUND',
@@ -126,12 +153,18 @@ const credentialInputSchema = z.discriminatedUnion('kind', [
126
153
  scope: z.string().min(1).optional(),
127
154
  }),
128
155
  ]);
129
- /** A party as argo reads it: never its credential or its crew token. */
130
- const shownPartyBase = { name: z.string(), ownerShipId: z.string(), state: z.enum(['commissioning', 'awaitingCrew', 'crewed']), proxyShipId: z.string().nullable() };
156
+ /** A party as any actor reads it: never its credential or its crew token. */
157
+ const shownPartyBase = { name: z.string(), state: z.enum(['commissioning', 'awaitingCrew', 'crewed']), proxyShipId: z.string().nullable() };
131
158
  const shownPartySchema = z.discriminatedUnion('kind', [
132
159
  z.object({ ...shownPartyBase, kind: z.literal('mcpServer'), url: z.string(), credentialKind: z.enum(['bearer', 'clientCredentials']), concurrencyLimit: z.int() }),
133
160
  z.object({ ...shownPartyBase, kind: z.literal('mcpClient'), clientId: z.string() }),
134
161
  ]);
162
+ /** A party with its proxy ship's owner and scopes, read from the fleet (decision 0056): null while unknown. */
163
+ const fromFleet = { ownerShipId: z.string().nullable(), scopes: z.array(z.string()).nullable() };
164
+ const listedPartySchema = z.discriminatedUnion('kind', [
165
+ z.object({ ...shownPartyBase, ...fromFleet, kind: z.literal('mcpServer'), url: z.string(), credentialKind: z.enum(['bearer', 'clientCredentials']), concurrencyLimit: z.int() }),
166
+ z.object({ ...shownPartyBase, ...fromFleet, kind: z.literal('mcpClient'), clientId: z.string() }),
167
+ ]);
135
168
  /** The connection as the console reads it: whether the gateway serves the fleet, and its connection. */
136
169
  const connectionStatusOutputSchema = z.object({
137
170
  enabled: z.boolean(),
@@ -159,6 +192,7 @@ const OUTSIDE_PARTIES_CODES = {
159
192
  NOT_A_NETWORKER: 'FORBIDDEN',
160
193
  OPEN_NETWORK: 'PRECONDITION_FAILED',
161
194
  FLEET_UNAVAILABLE: 'BAD_GATEWAY',
195
+ NOT_AN_ACTOR: 'UNAUTHORIZED',
162
196
  };
163
197
  /** A pending request as the API answers it: its times as ISO text. */
164
198
  const pendingRequestSchema = z.object({
@@ -169,7 +203,7 @@ const pendingRequestSchema = z.object({
169
203
  askedAt: z.string(),
170
204
  expiresAt: z.string(),
171
205
  state: z.enum(['pending', 'approving', 'approved', 'denied', 'expired']),
172
- decidedBy: z.union([z.object({ kind: z.literal('ship'), shipId: z.string() }), z.object({ kind: z.enum(['operator', 'viewer']) })]).nullable(),
206
+ decidedBy: z.union([z.object({ kind: z.literal('ship'), shipId: z.string() }), z.object({ kind: z.literal('account'), accountId: z.string() }), z.object({ kind: z.enum(['operator', 'viewer']) })]).nullable(),
173
207
  decidedAt: z.string().nullable(),
174
208
  });
175
209
  function shownRequestOf(request) {
@@ -184,6 +218,29 @@ const decisionSchema = z.discriminatedUnion('kind', [
184
218
  server: z.strictObject({ credential: credentialInputSchema, concurrencyLimit: z.int().min(CONCURRENCY_LIMIT_MIN).max(CONCURRENCY_LIMIT_MAX) }).optional(),
185
219
  }),
186
220
  ]);
221
+ /** The largest payload a message carries. */
222
+ const PAYLOAD_MAX_BYTES = 64 * 1024;
223
+ /** The refusals of a person's own deliveries, as the API states them. */
224
+ const PERSON_CODES = {
225
+ NOT_A_PERSON: 'FORBIDDEN',
226
+ SIGNED_OUT: 'UNAUTHORIZED',
227
+ FLEET_UNAVAILABLE: 'BAD_GATEWAY',
228
+ NO_SUCH_DELIVERY: 'NOT_FOUND',
229
+ SEND_REFUSED: 'BAD_REQUEST',
230
+ };
231
+ function personAnswerOf(answered) {
232
+ if (!answered.isOk) {
233
+ throw new TRPCError({ code: PERSON_CODES[answered.error.kind], message: answered.error.message });
234
+ }
235
+ return answered.value;
236
+ }
237
+ /** A person signed in to the pages, acting on their own person ship: only an account has one. */
238
+ const personProcedure = actorProcedure.use(({ ctx, next }) => {
239
+ if (ctx.actor.kind !== 'account' || ctx.person === undefined) {
240
+ throw new TRPCError({ code: 'FORBIDDEN', message: "Only a person signed in to the gateway's pages has a person ship's deliveries here" });
241
+ }
242
+ return next({ ctx: { person: ctx.person, caller: { fleetId: ctx.actor.fleetId, grantId: ctx.actor.grantId } } });
243
+ });
187
244
  export const gatewayRouter = t.router({
188
245
  connection: t.router({
189
246
  /** Whether the gateway is connected to the operator's fleet, as which ship, and the ship it was last connected as. */
@@ -196,8 +253,8 @@ export const gatewayRouter = t.router({
196
253
  /**
197
254
  * Connects the gateway with its ship's secret, which the console's server
198
255
  * hands over server to server: it registers with it and keeps only the
199
- * crew token. Only while not connected, while the gateway serves the
200
- * fleet, and in a fleet with a registered networking plugin (interop I-3).
256
+ * crew token. Only while not connected, and while the gateway serves the
257
+ * fleet.
201
258
  */
202
259
  connect: managing(servedProcedure)
203
260
  .input(z.object({ shipId: idSchema('ship'), secret: z.string().min(1) }))
@@ -212,8 +269,46 @@ export const gatewayRouter = t.router({
212
269
  }),
213
270
  }),
214
271
  parties: t.router({
215
- /** The parties argo approved for its fleet, by name. A viewer reads them too. */
216
- list: servedProcedure.output(z.array(shownPartySchema)).query(({ ctx }) => ctx.listParties(ctx.fleetId)),
272
+ /** The fleet's outside parties, by name, each with its proxy ship's owner and scopes from the fleet, read as the actor. Any actor reads them. */
273
+ list: servedProcedure.output(z.array(listedPartySchema)).query(({ ctx }) => ctx.listParties({ actor: ctx.actor, as: { cookie: ctx.cookie, crewToken: ctx.crewToken } })),
274
+ /** One outside party, as the list shows it. */
275
+ get: servedProcedure
276
+ .input(z.strictObject({ name: shipHandleSchema }))
277
+ .output(listedPartySchema)
278
+ .query(async ({ ctx, input }) => {
279
+ const read = await ctx.readParty({ actor: ctx.actor, as: { cookie: ctx.cookie, crewToken: ctx.crewToken }, ...input });
280
+ if (!read.isOk) {
281
+ throw new TRPCError({ code: 'NOT_FOUND', message: read.error.message });
282
+ }
283
+ return read.value;
284
+ }),
285
+ /** An outside MCP server's tools, as the server lists them now, asked with the credential the gateway keeps. Any actor reads them. */
286
+ tools: servedProcedure
287
+ .input(z.strictObject({ name: shipHandleSchema }))
288
+ .output(z.object({ tools: z.array(z.object({ name: z.string(), description: z.string().optional() })) }))
289
+ .query(async ({ ctx, input }) => {
290
+ const read = await ctx.readPartyTools({ fleetId: ctx.fleetId, ...input });
291
+ if (!read.isOk) {
292
+ throw new TRPCError({ code: TOOLS_CODES[read.error.kind], message: read.error.message });
293
+ }
294
+ return read.value;
295
+ }),
296
+ /**
297
+ * An actor holding fleet:manage checks an outside MCP server before
298
+ * approving it (F10): the tools it lists with the credential sent. The
299
+ * gateway keeps nothing and commissions nothing. A mutation, so the
300
+ * credential travels in the body, never in a URL.
301
+ */
302
+ check: managing(servedProcedure)
303
+ .input(z.strictObject({ url: z.url({ protocol: /^https?$/ }), credential: credentialInputSchema }))
304
+ .output(z.object({ tools: z.array(z.object({ name: z.string(), description: z.string().optional() })) }))
305
+ .mutation(async ({ ctx, input }) => {
306
+ const checked = await ctx.checkServer({ fleetId: ctx.fleetId, ...input });
307
+ if (!checked.isOk) {
308
+ throw new TRPCError({ code: CHECK_CODES[checked.error.kind], message: checked.error.message });
309
+ }
310
+ return checked.value;
311
+ }),
217
312
  /**
218
313
  * argo approves an outside MCP server as a party: the gateway commissions
219
314
  * its app proxy ship owned by the owner argo picked, crews it, and keeps
@@ -237,6 +332,43 @@ export const gatewayRouter = t.router({
237
332
  }
238
333
  return approved.value;
239
334
  }),
335
+ /**
336
+ * An actor holding fleet:manage retires a party (decision 0056): its proxy
337
+ * ship is retired in the fleet as the actor, within its manage reach, and
338
+ * the gateway forgets the party. Adding it again is a new request.
339
+ */
340
+ /** An actor holding fleet:owner sets a party's owner: its proxy ship's, in the fleet, as the actor (decision 0056). */
341
+ changeOwner: servedProcedure
342
+ .input(z.strictObject({ name: shipHandleSchema, ownerShipId: idSchema('ship') }))
343
+ .output(z.object({}))
344
+ .mutation(async ({ ctx, input }) => {
345
+ const changed = await ctx.changePartyOwner({ actor: ctx.actor, as: { cookie: ctx.cookie, crewToken: ctx.crewToken }, ...input });
346
+ if (!changed.isOk) {
347
+ throw new TRPCError({ code: CHANGE_CODES[changed.error.kind], message: changed.error.message });
348
+ }
349
+ return {};
350
+ }),
351
+ /** An actor holding scopes:grant grants and revokes a party's scopes, only scopes it holds: every scope its proxy ship holds now (decision 0056). */
352
+ changeScopes: servedProcedure
353
+ .input(z.strictObject({ name: shipHandleSchema, grant: z.array(z.string()), revoke: z.array(z.string()) }))
354
+ .output(z.object({ scopes: z.array(z.string()) }))
355
+ .mutation(async ({ ctx, input }) => {
356
+ const changed = await ctx.changePartyScopes({ actor: ctx.actor, as: { cookie: ctx.cookie, crewToken: ctx.crewToken }, ...input });
357
+ if (!changed.isOk) {
358
+ throw new TRPCError({ code: CHANGE_CODES[changed.error.kind], message: changed.error.message });
359
+ }
360
+ return changed.value;
361
+ }),
362
+ retire: servedProcedure
363
+ .input(z.strictObject({ name: shipHandleSchema }))
364
+ .output(z.object({}))
365
+ .mutation(async ({ ctx, input }) => {
366
+ const retired = await ctx.retireParty({ actor: ctx.actor, as: { cookie: ctx.cookie, crewToken: ctx.crewToken }, ...input });
367
+ if (!retired.isOk) {
368
+ throw new TRPCError({ code: RETIRE_CODES[retired.error.kind], message: retired.error.message });
369
+ }
370
+ return {};
371
+ }),
240
372
  /** argo hands over a new secret, from a new starting prompt in the console, for a proxy ship that awaits crew. */
241
373
  crew: managing(servedProcedure)
242
374
  .input(z.strictObject({ name: shipHandleSchema, secret: z.string().min(1) }))
@@ -271,7 +403,27 @@ export const gatewayRouter = t.router({
271
403
  return stated.value;
272
404
  }),
273
405
  }),
406
+ people: t.router({
407
+ /** What waits for the person's own ship, by titles only (Q20). */
408
+ inbox: personProcedure.query(async ({ ctx }) => personAnswerOf(await ctx.person.readInbox(ctx.caller))),
409
+ /** Opens one delivery, whole; the gateway acknowledges it for them. */
410
+ open: personProcedure.input(z.strictObject({ deliveryId: z.string().min(1) })).mutation(async ({ ctx, input }) => personAnswerOf(await ctx.person.openDelivery({ caller: ctx.caller, ...input }))),
411
+ /** Answers a delivery they opened, to its sender. */
412
+ answer: personProcedure
413
+ .input(z.strictObject({ deliveryId: z.string().min(1), contentType: z.string().min(1), payload: z.string().max(PAYLOAD_MAX_BYTES) }))
414
+ .mutation(async ({ ctx, input }) => personAnswerOf(await ctx.person.answerDelivery({ caller: ctx.caller, ...input }))),
415
+ /** Is done with a delivery they opened, with no answer. */
416
+ done: personProcedure.input(z.strictObject({ deliveryId: z.string().min(1) })).mutation(async ({ ctx, input }) => personAnswerOf(await ctx.person.doneDelivery({ caller: ctx.caller, ...input }))),
417
+ }),
274
418
  requests: t.router({
419
+ /** The requests the account asked, in any state, the newest first (decision 0056: Your requests). */
420
+ mine: actorProcedure.output(z.array(pendingRequestSchema)).query(async ({ ctx }) => {
421
+ const listed = await ctx.listMine(ctx.actor);
422
+ if (!listed.isOk) {
423
+ throw new TRPCError({ code: 'FORBIDDEN', message: listed.error.message });
424
+ }
425
+ return listed.value.map(shownRequestOf);
426
+ }),
275
427
  /** Every open request of the fleet, for an actor holding gateway:approve (decision 0056). */
276
428
  toDecide: servedProcedure.output(z.array(pendingRequestSchema)).query(async ({ ctx }) => {
277
429
  const listed = await ctx.listToDecide(ctx.actor);