@agents24/client 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +47 -0
- package/compatibility.json +54 -0
- package/dist/adapters/browser.d.ts +3 -0
- package/dist/adapters/browser.js +12 -0
- package/dist/adapters/browser.js.map +1 -0
- package/dist/adapters/cloudflare.d.ts +3 -0
- package/dist/adapters/cloudflare.js +12 -0
- package/dist/adapters/cloudflare.js.map +1 -0
- package/dist/adapters/node.d.ts +3 -0
- package/dist/adapters/node.js +12 -0
- package/dist/adapters/node.js.map +1 -0
- package/dist/adapters/worker.d.ts +3 -0
- package/dist/adapters/worker.js +12 -0
- package/dist/adapters/worker.js.map +1 -0
- package/dist/base64url.d.ts +2 -0
- package/dist/capabilities.d.ts +7 -0
- package/dist/chunk-45ITVMX3.js +977 -0
- package/dist/chunk-45ITVMX3.js.map +1 -0
- package/dist/chunk-VVLMMNXI.js +163 -0
- package/dist/chunk-VVLMMNXI.js.map +1 -0
- package/dist/client.d.ts +2 -0
- package/dist/context-window.d.ts +44 -0
- package/dist/dpop.d.ts +43 -0
- package/dist/errors.d.ts +27 -0
- package/dist/generated/protocol.d.ts +70 -0
- package/dist/http.d.ts +38 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +557 -0
- package/dist/index.js.map +1 -0
- package/dist/multipart.d.ts +2 -0
- package/dist/protocol.d.ts +5 -0
- package/dist/protocol.js +146 -0
- package/dist/protocol.js.map +1 -0
- package/dist/runtime-types.d.ts +93 -0
- package/dist/sessions.d.ts +63 -0
- package/dist/stream.d.ts +20 -0
- package/dist/types.d.ts +367 -0
- package/dist/url.d.ts +5 -0
- package/package.json +88 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Talmudpedia
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# `@agents24/client`
|
|
2
|
+
|
|
3
|
+
Last Updated: 2026-07-16
|
|
4
|
+
|
|
5
|
+
Framework-neutral end-user runtime client for one deployment-scoped Agents24 Agent. It supports public client sessions, authenticated streaming, durable reconnect, threads, attachments, HITL, and MCP without accepting organization API keys.
|
|
6
|
+
|
|
7
|
+
The root package uses structural capabilities and resolves without DOM or Node declarations. Runtime adapter subpaths provide verified global-capability bindings. The canonical wire validators and SSE parser are exported from `@agents24/client/protocol`.
|
|
8
|
+
|
|
9
|
+
Persistent refresh grants require DPoP and an explicit storage adapter. `createFencedRefreshCoordinator` accepts an atomic compare-and-swap store for cross-tab refresh rotation; lease takeovers retain the server idempotency operation ID and stale owners cannot write rotated credentials. Access tokens remain memory-only.
|
|
10
|
+
|
|
11
|
+
Allowlisted host headers can be carried through `chat.stream` and durable `runs.attach`; authentication, DPoP, Origin, cache, content-type, and idempotency headers remain client-owned and cannot be overridden.
|
|
12
|
+
|
|
13
|
+
## Browser quickstart
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createAnonymousSessionProvider } from "@agents24/client";
|
|
17
|
+
import { createBrowserAgentClient } from "@agents24/client/browser";
|
|
18
|
+
|
|
19
|
+
const baseUrl = "https://api.agents24.example";
|
|
20
|
+
const deploymentId = "public-deployment-id";
|
|
21
|
+
const sessionProvider = createAnonymousSessionProvider({ baseUrl, deploymentId });
|
|
22
|
+
const client = createBrowserAgentClient({ baseUrl, deploymentId, sessionProvider });
|
|
23
|
+
|
|
24
|
+
await client.chat.stream({ input: "Hello" }, (event) => {
|
|
25
|
+
console.log(event.seq, event.event, event.payload);
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Use `createManagedSessionProvider` when a trusted backend mints a session after authenticating the user. The backend must derive the subject from its own session and accept only deployment-registered origins/native profiles. Use `createHostedOidcSessionProvider` for hosted Authorization Code + PKCE. Organization keys, raw customer identities, tenant IDs, Agent/version choices, and fixed credential bindings never belong in client runtime requests.
|
|
30
|
+
|
|
31
|
+
The client also exposes threads, thread-summary events, run attach/cancel, attachments, HITL resume, MCP authorization, refresh, and revoke. Aborting a stream detaches locally; call `client.runs.cancel` for durable cancellation.
|
|
32
|
+
|
|
33
|
+
`compatibility.json` contains the exact generated contract hash, protocol versions, peers, and target operation counts. Do not infer compatibility from semver alone.
|
|
34
|
+
|
|
35
|
+
## Runtime status
|
|
36
|
+
|
|
37
|
+
| Runtime | Status |
|
|
38
|
+
| --- | --- |
|
|
39
|
+
| Browser/Vite, dedicated workers, Node 22/24 | GA candidates; promotion requires the final cross-browser and CI matrix |
|
|
40
|
+
| Cloudflare Workers | Pre-beta; packed local workerd conformance passes, but the deployed Worker smoke is not yet authorized or verified |
|
|
41
|
+
| Bun 1.3 and Deno 2 | Pre-beta; packed local portable matrix passes, dedicated CI must be green for promotion |
|
|
42
|
+
| Service Workers | Experimental; packed termination/restart with durable cursor reattach passes, full operation coverage is pending |
|
|
43
|
+
| Electron 43 renderer | Pre-beta on macOS; packaged sandbox/context isolation passes, native secure-store/session evidence is pending |
|
|
44
|
+
| Tauri 2 and Expo iOS/Android | Experimental and unverified; no support claim |
|
|
45
|
+
| Bare React Native/Metro | Experimental compile-only; packed iOS and Android bundles pass |
|
|
46
|
+
|
|
47
|
+
Run the maintained non-UI gates with `pnpm check:bun`, `pnpm check:deno`, `pnpm check:service-worker`, `pnpm check:electron`, and `pnpm check:metro`. Every gate installs an `npm pack` artifact rather than a workspace link.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"contractHash": "de2b507f5d56de2bf7c4d6739c03617c4b4feef6ae827aaaac5f1d6150ec678e",
|
|
3
|
+
"contractVersion": "0.2.0",
|
|
4
|
+
"corpus": "conformance/v1/corpus.json",
|
|
5
|
+
"generatedBy": "@agents24/sdk-contract",
|
|
6
|
+
"packages": {
|
|
7
|
+
"@agents24/ai-sdk": {
|
|
8
|
+
"ai": ">=7 <8",
|
|
9
|
+
"aiSdkReact": ">=4 <5",
|
|
10
|
+
"peer": "@agents24/client"
|
|
11
|
+
},
|
|
12
|
+
"@agents24/chat-react": {
|
|
13
|
+
"peer": "@agents24/react",
|
|
14
|
+
"react": ">=19 <20",
|
|
15
|
+
"reactDom": ">=19 <20"
|
|
16
|
+
},
|
|
17
|
+
"@agents24/client": {
|
|
18
|
+
"contract": "de2b507f5d56de2bf7c4d6739c03617c4b4feef6ae827aaaac5f1d6150ec678e",
|
|
19
|
+
"runtime": "run-stream.v2"
|
|
20
|
+
},
|
|
21
|
+
"@agents24/node": {
|
|
22
|
+
"contract": "de2b507f5d56de2bf7c4d6739c03617c4b4feef6ae827aaaac5f1d6150ec678e",
|
|
23
|
+
"node": "^22.0.0 || ^24.0.0"
|
|
24
|
+
},
|
|
25
|
+
"@agents24/react": {
|
|
26
|
+
"peer": "@agents24/client",
|
|
27
|
+
"react": ">=19 <20"
|
|
28
|
+
},
|
|
29
|
+
"@talmudpedia/runtime-sdk": {
|
|
30
|
+
"contract": "de2b507f5d56de2bf7c4d6739c03617c4b4feef6ae827aaaac5f1d6150ec678e",
|
|
31
|
+
"protocolOwner": "@agents24/client"
|
|
32
|
+
},
|
|
33
|
+
"agents24": {
|
|
34
|
+
"contract": "de2b507f5d56de2bf7c4d6739c03617c4b4feef6ae827aaaac5f1d6150ec678e",
|
|
35
|
+
"python": ">=3.10"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"protocols": {
|
|
39
|
+
"runtime": {
|
|
40
|
+
"minimum": "2.0.0",
|
|
41
|
+
"wire": "run-stream.v2"
|
|
42
|
+
},
|
|
43
|
+
"threadSummary": {
|
|
44
|
+
"minimum": "1.0.0",
|
|
45
|
+
"wire": "agents24.thread_summary_event.v1"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"schemaVersion": "agents24.compatibility.v1",
|
|
49
|
+
"targetOperationCounts": {
|
|
50
|
+
"client": 19,
|
|
51
|
+
"node": 55,
|
|
52
|
+
"python": 55
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createAgents24Client } from '../chunk-45ITVMX3.js';
|
|
2
|
+
import '../chunk-VVLMMNXI.js';
|
|
3
|
+
|
|
4
|
+
// src/adapters/browser.ts
|
|
5
|
+
var runtimeAdapter = "browser";
|
|
6
|
+
function createBrowserAgentClient(options) {
|
|
7
|
+
return createAgents24Client(options);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { createBrowserAgentClient, runtimeAdapter };
|
|
11
|
+
//# sourceMappingURL=browser.js.map
|
|
12
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/adapters/browser.ts"],"names":[],"mappings":";;;;AAGO,IAAM,cAAA,GAAiB;AAEvB,SAAS,yBAAyB,OAAA,EAA6C;AACpF,EAAA,OAAO,qBAAqB,OAAO,CAAA;AACrC","file":"browser.js","sourcesContent":["import { createAgents24Client } from \"../client.js\";\nimport type { AgentClient, Agents24ClientOptions } from \"../types.js\";\n\nexport const runtimeAdapter = \"browser\" as const;\n\nexport function createBrowserAgentClient(options: Agents24ClientOptions): AgentClient {\n return createAgents24Client(options);\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createAgents24Client } from '../chunk-45ITVMX3.js';
|
|
2
|
+
import '../chunk-VVLMMNXI.js';
|
|
3
|
+
|
|
4
|
+
// src/adapters/cloudflare.ts
|
|
5
|
+
var runtimeAdapter = "cloudflare";
|
|
6
|
+
function createCloudflareAgentClient(options) {
|
|
7
|
+
return createAgents24Client(options);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { createCloudflareAgentClient, runtimeAdapter };
|
|
11
|
+
//# sourceMappingURL=cloudflare.js.map
|
|
12
|
+
//# sourceMappingURL=cloudflare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/adapters/cloudflare.ts"],"names":[],"mappings":";;;;AAGO,IAAM,cAAA,GAAiB;AAEvB,SAAS,4BAA4B,OAAA,EAA6C;AACvF,EAAA,OAAO,qBAAqB,OAAO,CAAA;AACrC","file":"cloudflare.js","sourcesContent":["import { createAgents24Client } from \"../client.js\";\nimport type { AgentClient, Agents24ClientOptions } from \"../types.js\";\n\nexport const runtimeAdapter = \"cloudflare\" as const;\n\nexport function createCloudflareAgentClient(options: Agents24ClientOptions): AgentClient {\n return createAgents24Client(options);\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createAgents24Client } from '../chunk-45ITVMX3.js';
|
|
2
|
+
import '../chunk-VVLMMNXI.js';
|
|
3
|
+
|
|
4
|
+
// src/adapters/node.ts
|
|
5
|
+
var runtimeAdapter = "node";
|
|
6
|
+
function createNodeAgentClient(options) {
|
|
7
|
+
return createAgents24Client(options);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { createNodeAgentClient, runtimeAdapter };
|
|
11
|
+
//# sourceMappingURL=node.js.map
|
|
12
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/adapters/node.ts"],"names":[],"mappings":";;;;AAGO,IAAM,cAAA,GAAiB;AAEvB,SAAS,sBAAsB,OAAA,EAA6C;AACjF,EAAA,OAAO,qBAAqB,OAAO,CAAA;AACrC","file":"node.js","sourcesContent":["import { createAgents24Client } from \"../client.js\";\nimport type { AgentClient, Agents24ClientOptions } from \"../types.js\";\n\nexport const runtimeAdapter = \"node\" as const;\n\nexport function createNodeAgentClient(options: Agents24ClientOptions): AgentClient {\n return createAgents24Client(options);\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createAgents24Client } from '../chunk-45ITVMX3.js';
|
|
2
|
+
import '../chunk-VVLMMNXI.js';
|
|
3
|
+
|
|
4
|
+
// src/adapters/worker.ts
|
|
5
|
+
var runtimeAdapter = "worker";
|
|
6
|
+
function createWorkerAgentClient(options) {
|
|
7
|
+
return createAgents24Client(options);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { createWorkerAgentClient, runtimeAdapter };
|
|
11
|
+
//# sourceMappingURL=worker.js.map
|
|
12
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/adapters/worker.ts"],"names":[],"mappings":";;;;AAGO,IAAM,cAAA,GAAiB;AAEvB,SAAS,wBAAwB,OAAA,EAA6C;AACnF,EAAA,OAAO,qBAAqB,OAAO,CAAA;AACrC","file":"worker.js","sourcesContent":["import { createAgents24Client } from \"../client.js\";\nimport type { AgentClient, Agents24ClientOptions } from \"../types.js\";\n\nexport const runtimeAdapter = \"worker\" as const;\n\nexport function createWorkerAgentClient(options: Agents24ClientOptions): AgentClient {\n return createAgents24Client(options);\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Clock, FetchLike, IdProvider, TextDecoderLike, TextEncoderLike } from "./types.js";
|
|
2
|
+
export declare function resolveFetch(injected?: FetchLike): FetchLike;
|
|
3
|
+
export declare function resolveDecoderFactory(injected?: () => TextDecoderLike): () => TextDecoderLike;
|
|
4
|
+
export declare function resolveEncoder(injected?: TextEncoderLike): TextEncoderLike;
|
|
5
|
+
export declare function defaultClock(): Clock;
|
|
6
|
+
export declare function defaultIds(): IdProvider;
|
|
7
|
+
export declare function secureRandomBytes(length: number): Uint8Array;
|