agents-city 0.4.0 → 0.5.2

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 (98) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.es.md +240 -11
  3. package/README.md +238 -11
  4. package/benchmarks/latency/fake-claude-cli.mjs +2 -1
  5. package/benchmarks/reception/README.md +16 -0
  6. package/benchmarks/reception/run.mjs +84 -0
  7. package/bin/agents-city.js +1 -0
  8. package/bin/connect +5 -0
  9. package/bin/hall.html +117 -18
  10. package/bin/navegador.mjs +170 -1
  11. package/bin/serve.py +201 -101
  12. package/bin/test +15 -3
  13. package/bin/test-arnes.py +192 -0
  14. package/bin/test-cage.py +9 -0
  15. package/bin/test-channel.py +178 -12
  16. package/bin/test-claude-runtime.py +132 -4
  17. package/bin/test-connect-client.mjs +609 -0
  18. package/bin/test-connect.py +52 -0
  19. package/bin/test-contracts.py +214 -0
  20. package/bin/test-diario.py +185 -0
  21. package/bin/test-doctor.py +31 -0
  22. package/bin/test-i18n.py +189 -0
  23. package/bin/test-navegador.py +61 -0
  24. package/bin/test-seat.py +78 -20
  25. package/bin/test-security.py +2 -0
  26. package/bin/test-serve.py +366 -0
  27. package/city/web/dist-hall/hall.js +789 -214
  28. package/city/web/src/bienvenida.ts +14 -13
  29. package/city/web/src/casa.ts +143 -56
  30. package/city/web/src/demo.ts +61 -31
  31. package/city/web/src/es.ts +187 -27
  32. package/city/web/src/explorador.ts +70 -43
  33. package/city/web/src/hall.ts +520 -103
  34. package/city/web/src/idioma.ts +21 -1
  35. package/city/web/src/motores.ts +48 -1
  36. package/city/web/src/vista.ts +58 -0
  37. package/demo/graba.py +5 -10
  38. package/docs/managed-connect.md +237 -0
  39. package/docs/security.md +41 -2
  40. package/package.json +8 -4
  41. package/plugin/.claude-plugin/plugin.json +1 -1
  42. package/plugin/channel/adapter-prompts.ts +10 -0
  43. package/plugin/channel/adapter.js +78 -31
  44. package/plugin/channel/agents_city_hybrid_crypto_bg.wasm +0 -0
  45. package/plugin/channel/bus.js +109 -65
  46. package/plugin/channel/bus.ts +11 -1
  47. package/plugin/channel/client.js +67 -30
  48. package/plugin/channel/delivery-queue.ts +160 -21
  49. package/plugin/channel/hub/remote-roads.ts +32 -1
  50. package/plugin/channel/hub/road-controller.ts +116 -16
  51. package/plugin/channel/kinsh_vodozemac_wasm_bg.wasm +0 -0
  52. package/plugin/channel/licenses/CONNECT_CLIENT_THIRD_PARTY_NOTICES.md +21 -0
  53. package/plugin/channel/licenses/HYBRID_CRYPTO_THIRD_PARTY_NOTICES.md +12 -0
  54. package/plugin/channel/licenses/hybrid-crypto-Apache-2.0.txt +201 -0
  55. package/plugin/channel/licenses/keyring-MIT.txt +21 -0
  56. package/plugin/channel/licenses/vodozemac-Apache-2.0.txt +201 -0
  57. package/plugin/channel/local-hub.js +2080 -97
  58. package/plugin/channel/local-hub.ts +5 -4
  59. package/plugin/channel/managed-connect/bridge.ts +208 -0
  60. package/plugin/channel/managed-connect/cli.ts +416 -0
  61. package/plugin/channel/managed-connect/device.ts +15 -0
  62. package/plugin/channel/managed-connect/local-cities.ts +94 -0
  63. package/plugin/channel/managed-connect/person-message.ts +74 -0
  64. package/plugin/channel/managed-connect/reception-bridge.ts +341 -0
  65. package/plugin/channel/managed-connect/relay-session.ts +7 -0
  66. package/plugin/channel/managed-connect/storage.ts +653 -0
  67. package/plugin/channel/managed-connect/transport.ts +87 -0
  68. package/plugin/channel/managed-connect-cli.js +4777 -0
  69. package/plugin/channel/managed-connect-cli.ts +7 -0
  70. package/plugin/channel/managed-connect-client.d.ts +261 -0
  71. package/plugin/channel/managed-connect-client.js +6572 -0
  72. package/plugin/channel/managed-connect-client.manifest.json +38 -0
  73. package/plugin/channel/package-lock.json +123 -105
  74. package/plugin/channel/package.json +4 -4
  75. package/plugin/channel/protocol.ts +4 -0
  76. package/plugin/channel/reception.ts +896 -0
  77. package/plugin/channel/road-cli.ts +1 -1
  78. package/plugin/channel/runtime/arnes.json +189 -0
  79. package/plugin/channel/runtime/arnes.ts +47 -0
  80. package/plugin/channel/runtime/claude.ts +18 -0
  81. package/plugin/channel/runtime/codex-config.ts +51 -1
  82. package/plugin/channel/runtime/codex.ts +31 -11
  83. package/plugin/channel/runtime/kimi.ts +6 -4
  84. package/plugin/channel/runtime-files.ts +39 -5
  85. package/plugin/channel/runtime-gateway.js +426 -100
  86. package/plugin/channel/runtime-gateway.ts +12 -0
  87. package/plugin/channel/trust/agents-city-sandbox-roots.json +66 -0
  88. package/plugin/scripts/arnes.py +271 -0
  89. package/plugin/scripts/busca.py +46 -10
  90. package/plugin/scripts/cage.py +5 -0
  91. package/plugin/scripts/city-session.sh +144 -28
  92. package/plugin/scripts/crecimiento.py +4 -1
  93. package/plugin/scripts/demos.py +58 -43
  94. package/plugin/scripts/desinstala.py +36 -21
  95. package/plugin/scripts/diario.py +119 -0
  96. package/plugin/scripts/doctor.py +90 -15
  97. package/plugin/scripts/read-card.py +48 -8
  98. package/plugin/scripts/reception.py +665 -0
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { managedConnectCli } from './managed-connect/cli.js';
3
+
4
+ managedConnectCli().catch((error) => {
5
+ console.error(`agents-city connect: ${error instanceof Error ? error.message : String(error)}`);
6
+ process.exitCode = 1;
7
+ });
@@ -0,0 +1,261 @@
1
+ /** Public declaration facade for the generated Agents City Connect runtime. */
2
+ export type RatchetPublicBundle = {
3
+ identityKey: string;
4
+ signingKey: string;
5
+ oneTimeKeys: Array<{ id: string; key: string }>;
6
+ };
7
+
8
+ export type HybridOneTimeKey = { id: string; publicKey: string };
9
+ export class RoadRatchet {}
10
+
11
+ export type DeviceKeys = {
12
+ signingPublicJwk: JsonWebKey;
13
+ signingPrivateJwk: JsonWebKey;
14
+ encryptionPublicJwk: JsonWebKey;
15
+ encryptionPrivateJwk: JsonWebKey;
16
+ ratchet: RoadRatchet;
17
+ ratchetBundle: RatchetPublicBundle;
18
+ hybridPrekeys: HybridOneTimeKey[];
19
+ };
20
+
21
+ export type DeviceIdentity = DeviceKeys & {
22
+ deviceId: string;
23
+ ownerPrefix: string;
24
+ relayUrl: string;
25
+ keyVersion: number;
26
+ };
27
+
28
+ export type DeviceAuthorization = {
29
+ device_code: string;
30
+ user_code: string;
31
+ verification_uri: string;
32
+ expires_in: number;
33
+ interval: number;
34
+ signing_key_thumbprint: string;
35
+ };
36
+
37
+ export type KeyTransparencyTrust = {
38
+ operatorKeyId: string;
39
+ operatorSigningPublicJwk: JsonWebKey;
40
+ witnessKeys: Readonly<Record<string, JsonWebKey>>;
41
+ minimumWitnesses: number;
42
+ maximumHeadAgeMs: number;
43
+ maximumWitnessLagMs: number;
44
+ };
45
+
46
+ export type KeyTransparencyRootRole = {
47
+ keyIds: string[];
48
+ threshold: number;
49
+ };
50
+
51
+ export type KeyTransparencyRootMetadata = {
52
+ protocol: 'agents-city-key-transparency-root/1';
53
+ version: number;
54
+ environment: 'sandbox' | 'production';
55
+ controlPlaneUrl: string;
56
+ relayUrl: string;
57
+ issuedAt: number;
58
+ expiresAt: number;
59
+ previousRootHash: string | null;
60
+ keys: Readonly<Record<string, JsonWebKey>>;
61
+ roles: Readonly<Record<'root' | 'operator' | 'witness', KeyTransparencyRootRole>>;
62
+ maximumHeadAgeMs: number;
63
+ maximumWitnessLagMs: number;
64
+ };
65
+
66
+ export type KeyTransparencyRootSignature = {
67
+ protocol: 'agents-city-key-transparency-root-signature/1';
68
+ keyId: string;
69
+ signature: string;
70
+ };
71
+
72
+ export type KeyTransparencyRootEnvelope = {
73
+ signed: KeyTransparencyRootMetadata;
74
+ signatures: KeyTransparencyRootSignature[];
75
+ };
76
+
77
+ export type KeyTransparencyRootChain = {
78
+ protocol: 'agents-city-key-transparency-root-chain/1';
79
+ roots: KeyTransparencyRootEnvelope[];
80
+ };
81
+
82
+ export type SignedHybridPrekey = {
83
+ record: {
84
+ protocol: string;
85
+ suite: string;
86
+ keyId: string;
87
+ publicKey: string;
88
+ signingKeyId: string;
89
+ keyVersion: number;
90
+ };
91
+ signature: string;
92
+ };
93
+
94
+ export type RelayRoadDirectoryEntry = {
95
+ id: string;
96
+ revision: number;
97
+ localCity: string;
98
+ peerCity: string;
99
+ localEncryptionKeyId: string;
100
+ peerEncryptionKeyId: string;
101
+ peerSigningPublicJwk: JsonWebKey;
102
+ peerEncryptionPublicJwk: JsonWebKey;
103
+ ratchetRole: 'initiator' | 'responder';
104
+ peerDeviceId: string;
105
+ peerRatchetIdentityKey: string;
106
+ peerRatchetSigningKey: string;
107
+ peerOneTimeKeyId: string | null;
108
+ peerOneTimeKey: string | null;
109
+ establishmentSuite: string;
110
+ peerHybridPrekey: SignedHybridPrekey | null;
111
+ localHybridPrekeyId: string | null;
112
+ };
113
+
114
+ export type DeviceRoad = RelayRoadDirectoryEntry & {
115
+ kind: 'city' | 'connection';
116
+ connectionId: string | null;
117
+ peerName: string;
118
+ purpose: string | null;
119
+ peerSigningKeyId: string;
120
+ };
121
+
122
+ export type UntrustedRoadText = {
123
+ trust: 'untrusted_remote_text';
124
+ roadId: string;
125
+ messageId: string;
126
+ from: string;
127
+ to: string;
128
+ text: string;
129
+ };
130
+
131
+ export type RoadInboxReceipt = {
132
+ messageId: string;
133
+ status: 'inserted' | 'duplicate';
134
+ };
135
+
136
+ export type RelayTransport = {
137
+ send(raw: string): void;
138
+ close(code?: number, reason?: string): void;
139
+ onMessage(handler: (raw: string) => void): void;
140
+ onClose(handler: () => void): void;
141
+ };
142
+
143
+ export type RelaySessionOptions = {
144
+ requestTimeoutMs?: number;
145
+ readyTimeoutMs?: number;
146
+ onText(message: UntrustedRoadText): RoadInboxReceipt | Promise<RoadInboxReceipt>;
147
+ onSecurityError?(error: Error): void;
148
+ onLocalError?(error: Error): void;
149
+ keyTransparency?: {
150
+ controlPlaneUrl: string;
151
+ trust: KeyTransparencyTrust;
152
+ fetcher?: typeof fetch;
153
+ };
154
+ developmentUnsafeSkipKeyTransparency?: boolean;
155
+ sealedSender?: { endpointUrl?: string; fetcher?: typeof fetch };
156
+ };
157
+
158
+ export type SendRoadTextOptions = {
159
+ messageId?: string;
160
+ onAccepted?(result: { messageId: string; status: 'queued' | 'duplicate' }): void | Promise<void>;
161
+ };
162
+
163
+ export class ManagedRelaySession {
164
+ constructor(
165
+ identity: DeviceIdentity,
166
+ city: string,
167
+ transport: RelayTransport,
168
+ options: RelaySessionOptions,
169
+ );
170
+ ready(): Promise<void>;
171
+ roads(): RelayRoadDirectoryEntry[];
172
+ sendRoadText(
173
+ roadId: string,
174
+ text: string,
175
+ options?: SendRoadTextOptions,
176
+ ): Promise<{ messageId: string; status: 'queued' | 'duplicate' }>;
177
+ ping(): void;
178
+ close(): void;
179
+ }
180
+
181
+ export class NodeDeviceVault {
182
+ loadOrCreateKeys(): Promise<DeviceKeys>;
183
+ saveIdentity(identity: DeviceIdentity): Promise<DeviceIdentity | null>;
184
+ loadIdentity(): Promise<DeviceIdentity | null>;
185
+ }
186
+
187
+ export class ConnectApiError extends Error {
188
+ readonly code: string;
189
+ readonly status: number;
190
+ readonly retryAfterMs: number | null;
191
+ }
192
+
193
+ export const RELAY_PROTOCOL: 'agents-city-relay/4';
194
+ export const HYBRID_ESTABLISHMENT_SUITE: string;
195
+ export const KEY_TRANSPARENCY_PROTOCOL: 'agents-city-key-transparency/1';
196
+ export const KEY_TRANSPARENCY_ROOT_PROTOCOL: 'agents-city-key-transparency-root/1';
197
+ export const KEY_TRANSPARENCY_ROOT_CHAIN_PROTOCOL: 'agents-city-key-transparency-root-chain/1';
198
+ export const SEALED_SUITE: string;
199
+
200
+ export function parseKeyTransparencyRootChain(value: unknown): KeyTransparencyRootChain;
201
+ export function parseKeyTransparencyRootEnvelope(value: unknown): KeyTransparencyRootEnvelope;
202
+ export function hashKeyTransparencyRoot(value: unknown): Promise<string>;
203
+ export function createKeyTransparencyRootSignature(
204
+ root: unknown,
205
+ keyId: string,
206
+ privateJwk: unknown,
207
+ ): Promise<KeyTransparencyRootSignature>;
208
+ export function resolveKeyTransparencyRootChain(
209
+ chain: unknown,
210
+ persistedRoot?: unknown | null,
211
+ now?: number,
212
+ ): Promise<{ root: KeyTransparencyRootEnvelope; trust: KeyTransparencyTrust }>;
213
+
214
+ export function initializeHybridCrypto(input?: Uint8Array | WebAssembly.Module): Promise<void>;
215
+ export function createOsProtectedDeviceVault(options: {
216
+ directory: string;
217
+ service?: string;
218
+ account: string;
219
+ }): Promise<NodeDeviceVault>;
220
+ export function beginDeviceAuthorization(
221
+ controlPlaneUrl: string,
222
+ machineName: string,
223
+ platform: string,
224
+ keys: DeviceKeys,
225
+ fetcher?: typeof fetch,
226
+ ): Promise<DeviceAuthorization>;
227
+ export function pollDeviceAuthorization(
228
+ controlPlaneUrl: string,
229
+ authorization: DeviceAuthorization,
230
+ keys: DeviceKeys,
231
+ options?: {
232
+ onPending?: () => void;
233
+ signal?: AbortSignal;
234
+ fetcher?: typeof fetch;
235
+ },
236
+ ): Promise<DeviceIdentity>;
237
+ export function syncDeviceCities(
238
+ controlPlaneUrl: string,
239
+ identity: DeviceIdentity,
240
+ cities: Array<{ slug: string; name: string; connected?: boolean }>,
241
+ fetcher?: typeof fetch,
242
+ ): Promise<{
243
+ owner_prefix: string;
244
+ device_id: string;
245
+ allowance: number;
246
+ cities: Array<{
247
+ address: string;
248
+ name: string;
249
+ connected: boolean;
250
+ encryption_key_id: string;
251
+ }>;
252
+ }>;
253
+ export function listDeviceRoads(
254
+ controlPlaneUrl: string,
255
+ identity: DeviceIdentity,
256
+ fetcher?: typeof fetch,
257
+ ): Promise<{ protocol: string; device_id: string; roads: DeviceRoad[] }>;
258
+ export function signedRelayHeaders(
259
+ identity: DeviceIdentity,
260
+ city: string,
261
+ ): Promise<Record<string, string>>;