@converge.ai/a13n 0.0.93 → 0.0.95
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 +87 -61
- package/THIRD_PARTY_NOTICES.txt +83 -0
- package/dist/client.d.ts +1 -1
- package/dist/client.js +2 -2
- package/dist/client.js.map +1 -1
- package/dist/dispatch.d.ts +6 -0
- package/dist/dispatch.d.ts.map +1 -0
- package/dist/dispatch.js +19 -0
- package/dist/dispatch.js.map +1 -0
- package/dist/errors.d.ts +23 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +38 -5
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/resources/base.d.ts.map +1 -1
- package/dist/resources/base.js +5 -2
- package/dist/resources/base.js.map +1 -1
- package/dist/resources/generated.d.ts +3402 -1197
- package/dist/resources/generated.d.ts.map +1 -1
- package/dist/resources/generated.js +2170 -495
- package/dist/resources/generated.js.map +1 -1
- package/dist/resources/interaction.d.ts +1 -7
- package/dist/resources/interaction.d.ts.map +1 -1
- package/dist/resources/interaction.js +2 -30
- package/dist/resources/interaction.js.map +1 -1
- package/dist/schema.d.ts +14542 -6101
- package/dist/schema.d.ts.map +1 -1
- package/dist/semantic.d.ts +102 -118
- package/dist/semantic.d.ts.map +1 -1
- package/dist/semantic.js +461 -168
- package/dist/semantic.js.map +1 -1
- package/dist/session-stream-schema.d.ts +1773 -0
- package/dist/session-stream-schema.d.ts.map +1 -0
- package/dist/session-stream-schema.js +2 -0
- package/dist/session-stream-schema.js.map +1 -0
- package/dist/session-stream-validation.d.ts +128 -0
- package/dist/session-stream-validation.d.ts.map +1 -0
- package/dist/session-stream-validation.js +29384 -0
- package/dist/session-stream-validation.js.map +1 -0
- package/dist/streams/session-stream.d.ts +12 -0
- package/dist/streams/session-stream.d.ts.map +1 -0
- package/dist/streams/session-stream.js +36 -0
- package/dist/streams/session-stream.js.map +1 -0
- package/dist/streams/sse.d.ts +5 -1
- package/dist/streams/sse.d.ts.map +1 -1
- package/dist/streams/sse.js +11 -4
- package/dist/streams/sse.js.map +1 -1
- package/dist/streams/thread-stream.d.ts +8 -2
- package/dist/streams/thread-stream.d.ts.map +1 -1
- package/dist/streams/thread-stream.js +4 -2
- package/dist/streams/thread-stream.js.map +1 -1
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +3 -0
- package/dist/transport.js.map +1 -1
- package/dist/workflow.d.ts +117 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +90 -0
- package/dist/workflow.js.map +1 -0
- package/dist/workspace-scope.d.ts.map +1 -1
- package/dist/workspace-scope.js +117 -0
- package/dist/workspace-scope.js.map +1 -1
- package/openapi.json +32811 -10467
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @converge.ai/a13n
|
|
2
2
|
|
|
3
|
-
Start an Agent, continue its conversation, or
|
|
3
|
+
Start an Agent, get its authoritative reply, continue its conversation, or preview text from a Node.js application. The SDK talks to an existing a13n Service; it does not run Agents locally.
|
|
4
4
|
|
|
5
5
|
## Get ready
|
|
6
6
|
|
|
7
|
-
You need Node.js 22.14+, a Service URL, a workspace API key, and the **ID** of an Agent you can run.
|
|
7
|
+
You need Node.js 22.14+, a Service URL, a workspace API key, and the **ID** of an Agent you can run. Obtain them from your Service administrator or Console. The key selects its workspace automatically. The Agent needs a configured Model and provider access. Keep API keys out of source control and browser bundles.
|
|
8
8
|
|
|
9
9
|
**Install from this checkout during pre-release development:**
|
|
10
10
|
|
|
@@ -17,45 +17,41 @@ cd /path/to/your-node-app
|
|
|
17
17
|
npm install /path/to/a13n-sdk-typescript/converge.ai-a13n-0.0.0.tgz
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
The source version is `0.0.0`; a published registry package
|
|
20
|
+
The source version is `0.0.0`; this does not imply a published registry package. After a release, install that published version with `npm install @converge.ai/a13n` instead. This checkout targets the pinned Service contract, not unverified newer endpoints.
|
|
21
21
|
|
|
22
22
|
## Ask your Agent
|
|
23
23
|
|
|
24
|
-
Save this as `hello.mjs
|
|
24
|
+
Save this as `hello.mjs`:
|
|
25
25
|
|
|
26
26
|
```js
|
|
27
|
-
import { randomUUID } from "node:crypto";
|
|
28
27
|
import { createClient } from "@converge.ai/a13n";
|
|
29
28
|
|
|
30
29
|
for (const name of ["A13N_SERVICE_URL", "A13N_API_TOKEN", "A13N_AGENT_ID"]) {
|
|
31
30
|
if (!process.env[name]) throw new Error(`${name} is required`);
|
|
32
31
|
}
|
|
33
|
-
|
|
34
32
|
const client = createClient({
|
|
35
33
|
baseUrl: process.env.A13N_SERVICE_URL,
|
|
36
34
|
auth: { type: "bearer", token: process.env.A13N_API_TOKEN },
|
|
37
35
|
});
|
|
38
|
-
|
|
39
36
|
try {
|
|
40
37
|
const agent = client.agents.ref(process.env.A13N_AGENT_ID);
|
|
41
|
-
const interaction = await agent.start("Say hello in one sentence."
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
console.log(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
const interaction = await agent.start("Say hello in one sentence.");
|
|
39
|
+
try {
|
|
40
|
+
const result = await interaction.result();
|
|
41
|
+
if (result.status === "completed")
|
|
42
|
+
console.log(result.text ?? result.output);
|
|
43
|
+
else if (result.status === "waiting")
|
|
44
|
+
console.log(result.pendingCalls, result.pendingApprovals);
|
|
45
|
+
else console.log(result.status, result.failure);
|
|
46
|
+
console.log("Thread ID:", result.threadId, "Run ID:", result.runId);
|
|
47
|
+
} finally {
|
|
48
|
+
await interaction.close();
|
|
49
|
+
}
|
|
52
50
|
} finally {
|
|
53
51
|
client.close();
|
|
54
52
|
}
|
|
55
53
|
```
|
|
56
54
|
|
|
57
|
-
Set the variables in your shell, then run the file:
|
|
58
|
-
|
|
59
55
|
```bash
|
|
60
56
|
export A13N_SERVICE_URL="https://your-service.example"
|
|
61
57
|
export A13N_API_TOKEN="your-workspace-api-key"
|
|
@@ -63,69 +59,99 @@ export A13N_AGENT_ID="ap_your-agent-id"
|
|
|
63
59
|
node hello.mjs
|
|
64
60
|
```
|
|
65
61
|
|
|
66
|
-
The
|
|
62
|
+
The first reply comes directly from exact Run output—no Items scan, reducer or extra display request. `output` preserves structured JSON including null, false, zero and empty containers. Optional `text` exists only for string output, including the empty string. Check `status`: completed, waiting, failed and cancelled are distinct. `snapshot` retains the original HTTP response evidence.
|
|
67
63
|
|
|
68
|
-
Each
|
|
64
|
+
Each logical request needs one key. When omitted, the SDK chooses a random key once before dispatch and exposes `interaction.idempotencyKey`; it **never retries mutations**. Durable jobs must persist their own key and identical body before sending. A generated key is not promised recoverable from a cancelled invocation that never returns. See [uncertain submissions and recovery](docs/07-errors-and-recovery.md).
|
|
65
|
+
|
|
66
|
+
`result()` opens no SSE and observes only this submission's consumed Entry and exact incorporating Run. The default local deadline is five minutes, not a remote execution timeout. An initial assigned receipt Run is only `receiptRun` evidence; `interaction.run` becomes authoritative after incorporation.
|
|
69
67
|
|
|
70
68
|
## Continue the conversation
|
|
71
69
|
|
|
72
|
-
|
|
70
|
+
Retain `result.threadId`. Inside the same client lifetime, after inspecting a completed, failed or cancelled result:
|
|
73
71
|
|
|
74
72
|
```js
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
);
|
|
83
|
-
const nextResult = await followUp.result();
|
|
84
|
-
console.log(nextResult.status);
|
|
85
|
-
if (nextResult.status === "completed") {
|
|
86
|
-
console.log((await nextResult.run.items()).data.items);
|
|
87
|
-
}
|
|
88
|
-
} else {
|
|
89
|
-
console.log(
|
|
90
|
-
"Resolve or inspect the first Run before continuing:",
|
|
91
|
-
result.status,
|
|
92
|
-
);
|
|
73
|
+
const followUp = await agent.send(result.threadId, "What did you mean?");
|
|
74
|
+
try {
|
|
75
|
+
const next = await followUp.result();
|
|
76
|
+
console.log(next.status, next.text ?? next.output);
|
|
77
|
+
} finally {
|
|
78
|
+
await followUp.close();
|
|
93
79
|
}
|
|
94
80
|
```
|
|
95
81
|
|
|
96
|
-
|
|
82
|
+
A waiting Run needs its pending batch resolved first; a premature send can remain queued. `Thread.last_run_id` is the latest seal of any outcome. Failed/cancelled Runs retain checkpoint history for the next explicit send without automatic retry or fork. A Thread can receive messages from different Agents; send uses the selected Agent.
|
|
97
83
|
|
|
98
|
-
##
|
|
84
|
+
## Preview text as it arrives
|
|
99
85
|
|
|
100
|
-
For a
|
|
86
|
+
For a new interaction, consume the lazy string-chunk preview and then read the authoritative result:
|
|
101
87
|
|
|
102
88
|
```js
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
89
|
+
import { PreviewInterruptedError } from "@converge.ai/a13n";
|
|
90
|
+
|
|
91
|
+
const live = await agent.start("Explain your answer step by step.");
|
|
92
|
+
try {
|
|
93
|
+
try {
|
|
94
|
+
for await (const chunk of live.textStream()) process.stdout.write(chunk);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
if (!(error instanceof PreviewInterruptedError)) throw error;
|
|
97
|
+
console.error("Preview stopped:", error.message);
|
|
110
98
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
console.log((await finalResult.run.items()).data.items);
|
|
99
|
+
const final = await live.result();
|
|
100
|
+
console.log("\nFinal:", final.status, final.text ?? final.output);
|
|
101
|
+
} finally {
|
|
102
|
+
await live.close();
|
|
116
103
|
}
|
|
117
104
|
```
|
|
118
105
|
|
|
119
|
-
|
|
106
|
+
Only trusted root assistant string content is projected; child/hidden events are excluded. Gaps, missing starts, unsupported root custom fragments and other discontinuities interrupt preview explicitly rather than silently constructing a partial answer. Preview interruption is sticky, but the final result remains available and deliberate sequential raw access is allowed while open. No concurrent raw/text or multiple preview consumers are supported. Preview break leaves a local lifetime to close in `finally`; raw iterator break closes observation. `await close()` joins cleanup even if an iterator is paused. Local close never interrupts remote execution.
|
|
107
|
+
|
|
108
|
+
For native events use `for await (const event of interaction)`. Advanced Session observation uses `sessionStream(await client.api.sessions.ref(sessionId).stream.get())`, a one-connection typed decoder with caller-owned reconnect. Each new connection starts from a fresh snapshot; Session continuation is display state, never a Thread cursor. Items reads carry `{run,items,complete}` and no stream-progress fields. For full application-owned presentation, generated operations preserve raw AG-UI, HTTP status/ETags, binary ownership and display Items. See [streaming and readback](docs/02-streaming-and-readback.md).
|
|
109
|
+
|
|
110
|
+
## Public input and options
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
import { text, json, url, asset } from "@converge.ai/a13n";
|
|
114
|
+
|
|
115
|
+
const request = await agent.start(
|
|
116
|
+
[
|
|
117
|
+
text("Inspect these"),
|
|
118
|
+
json({ enabled: false }),
|
|
119
|
+
url("https://example.test/report"),
|
|
120
|
+
asset("ast_uploaded"),
|
|
121
|
+
],
|
|
122
|
+
{
|
|
123
|
+
agentRevisionId: null,
|
|
124
|
+
options: {
|
|
125
|
+
configuration: { allowed_hosts: null, extensions: {} },
|
|
126
|
+
overrides: { model_settings: { native: [null, 0, false] } },
|
|
127
|
+
labels: { purpose: "review" },
|
|
128
|
+
max_usage: { requests: 3 },
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
);
|
|
132
|
+
await request.close();
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Top-level submission selectors are camelCase; nested native options stay grouped. Root structural types include `RunOptions`, `RunConfiguration`, `AgentOverride`, `MessageHistory`, mount/header types and pending/status/failure primitives. Every supported uncommon override remains available without a generated-schema import. Output is native structured JSON: validate it in your application rather than asserting an Agent generic type.
|
|
136
|
+
|
|
137
|
+
## Native Service API
|
|
138
|
+
|
|
139
|
+
Use `client.api.agents.ref(agentId).get()` to read a stored Agent with its HTTP metadata, and `client.agents.ref(agentId).start(input)` to run it. Both layers share the same client, authentication and lifetime; the complete generated API is available under `client.api`.
|
|
140
|
+
|
|
141
|
+
The pinned native graph includes Memory Spaces and Session bindings, explicit organization status/action, Computer permission/probe and retained PNG/JPEG reads, executed Agent/attempt readback, per-Run usage and model-request metrics, Findings/analyses, explicit Run content reads, and Session message-author lookup. Use the [Memory Space guide](docs/04-files-and-memory.md#share-memory-through-a-session-space-binding) and [native execution/Computer readback](docs/06-generated-resources.md#read-executed-configuration-and-request-metrics) for their distinct authority and completion boundaries. `Item.content_refs` provides bounded previews; load saved values explicitly with `client.api.runs.ref(runId).contents.ref(contentId).get()`. Raw stream memory sources and Memory record provenance retain their native evidence. See [generated resources](docs/06-generated-resources.md#findings-and-analyses).
|
|
142
|
+
|
|
143
|
+
**Migration:** replace `client.resources` with `client.api`, and use generated `ProviderModel` in place of the retired `ChatGPTModel`. Authored Agent, Thread and Run workflows are unchanged. Omitted Skill policy now uses shared mode; select isolated caching explicitly when that layout is required. See [environment and Skill policy](docs/01-setup-and-conversations.md#select-environment-and-skill-preparation).
|
|
120
144
|
|
|
121
145
|
## Go further
|
|
122
146
|
|
|
123
147
|
- [Configure conversations and continue across calls](docs/01-setup-and-conversations.md)
|
|
124
148
|
- [Stream updates and reconcile committed output](docs/02-streaming-and-readback.md)
|
|
125
|
-
- [
|
|
149
|
+
- [Resolve waiting Runs with one public answer map](docs/03-waiting-and-tools.md)
|
|
126
150
|
- [Attach files and mount Memory](docs/04-files-and-memory.md)
|
|
127
151
|
- [Use a same-origin browser session](docs/05-browser-sessions.md)
|
|
128
|
-
- [
|
|
129
|
-
- [Recover
|
|
152
|
+
- [Manage generated resources with ETags](docs/06-generated-resources.md)
|
|
153
|
+
- [Recover saved Entry/Run identities without resubmitting](docs/07-errors-and-recovery.md)
|
|
154
|
+
|
|
155
|
+
The complete wire contract is in the [pinned OpenAPI](openapi.json) and [SDK specification](spec/README.md). [CONTRIBUTING.md](CONTRIBUTING.md) owns generation, validation and release procedures.
|
|
130
156
|
|
|
131
|
-
|
|
157
|
+
See [Execution options and migration](docs/execution-and-migration.md) for scoped command variables and compatibility notes.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Bundled Session validator runtime notices
|
|
2
|
+
|
|
3
|
+
The generated Session stream validator bundles portions of the packages below.
|
|
4
|
+
These components retain their original MIT licenses. The SDK's other code is
|
|
5
|
+
licensed under the Apache License 2.0 in LICENSE.
|
|
6
|
+
|
|
7
|
+
===============================================================================
|
|
8
|
+
ajv
|
|
9
|
+
===============================================================================
|
|
10
|
+
|
|
11
|
+
The MIT License (MIT)
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
14
|
+
|
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
in the Software without restriction, including without limitation the rights
|
|
18
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
furnished to do so, subject to the following conditions:
|
|
21
|
+
|
|
22
|
+
The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
copies or substantial portions of the Software.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
|
32
|
+
|
|
33
|
+
===============================================================================
|
|
34
|
+
ajv-formats
|
|
35
|
+
===============================================================================
|
|
36
|
+
|
|
37
|
+
MIT License
|
|
38
|
+
|
|
39
|
+
Copyright (c) 2020 Evgeny Poberezkin
|
|
40
|
+
|
|
41
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
42
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
43
|
+
in the Software without restriction, including without limitation the rights
|
|
44
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
45
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
46
|
+
furnished to do so, subject to the following conditions:
|
|
47
|
+
|
|
48
|
+
The above copyright notice and this permission notice shall be included in all
|
|
49
|
+
copies or substantial portions of the Software.
|
|
50
|
+
|
|
51
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
52
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
53
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
54
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
55
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
56
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
57
|
+
SOFTWARE.
|
|
58
|
+
|
|
59
|
+
===============================================================================
|
|
60
|
+
fast-deep-equal
|
|
61
|
+
===============================================================================
|
|
62
|
+
|
|
63
|
+
MIT License
|
|
64
|
+
|
|
65
|
+
Copyright (c) 2017 Evgeny Poberezkin
|
|
66
|
+
|
|
67
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
68
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
69
|
+
in the Software without restriction, including without limitation the rights
|
|
70
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
71
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
72
|
+
furnished to do so, subject to the following conditions:
|
|
73
|
+
|
|
74
|
+
The above copyright notice and this permission notice shall be included in all
|
|
75
|
+
copies or substantial portions of the Software.
|
|
76
|
+
|
|
77
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
78
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
79
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
80
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
81
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
82
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
83
|
+
SOFTWARE.
|
package/dist/client.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare function createClient(options: ClientOptions): {
|
|
|
6
6
|
agents: AgentCollection;
|
|
7
7
|
threads: ThreadCollection;
|
|
8
8
|
runs: RunCollection;
|
|
9
|
-
|
|
9
|
+
api: ServiceResources;
|
|
10
10
|
setCsrfToken: (token: string | undefined) => void;
|
|
11
11
|
setWorkspaceId: (id: string | undefined) => void;
|
|
12
12
|
close: () => void;
|
package/dist/client.js
CHANGED
|
@@ -7,9 +7,9 @@ export function createClient(options) {
|
|
|
7
7
|
const resources = new ServiceResources(transport);
|
|
8
8
|
return {
|
|
9
9
|
agents: new AgentCollection(resources, transport.signal),
|
|
10
|
-
threads: new ThreadCollection(resources),
|
|
10
|
+
threads: new ThreadCollection(resources, transport.signal),
|
|
11
11
|
runs: new RunCollection(resources, transport.signal),
|
|
12
|
-
resources,
|
|
12
|
+
api: resources,
|
|
13
13
|
setCsrfToken: (token) => transport.setCsrfToken(token),
|
|
14
14
|
setWorkspaceId: (id) => transport.setWorkspaceId(id),
|
|
15
15
|
close: () => transport.close(),
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,aAAa,EACb,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,sFAAsF;AACtF,MAAM,UAAU,YAAY,CAAC,OAAsB;IACjD,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,SAAS,GAAG,IAAI,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAClD,OAAO;QACL,MAAM,EAAE,IAAI,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC;QACxD,OAAO,EAAE,IAAI,gBAAgB,CAAC,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,aAAa,EACb,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,sFAAsF;AACtF,MAAM,UAAU,YAAY,CAAC,OAAsB;IACjD,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,SAAS,GAAG,IAAI,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAClD,OAAO;QACL,MAAM,EAAE,IAAI,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC;QACxD,OAAO,EAAE,IAAI,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC;QAC1D,IAAI,EAAE,IAAI,aAAa,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC;QACpD,GAAG,EAAE,SAAS;QACd,YAAY,EAAE,CAAC,KAAyB,EAAE,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC;QAC1E,cAAc,EAAE,CAAC,EAAsB,EAAE,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;QACxE,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE;KAC/B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function trackDispatch(signal: AbortSignal): {
|
|
2
|
+
attempted: boolean;
|
|
3
|
+
};
|
|
4
|
+
export declare function inheritDispatch(request: Request, signal: AbortSignal | undefined): Request;
|
|
5
|
+
export declare function markDispatch(signal: AbortSignal): void;
|
|
6
|
+
//# sourceMappingURL=dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW;;EAIhD;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,OAAO,CAIT;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAGtD"}
|
package/dist/dispatch.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Per-invocation dispatch evidence; no requests, credentials or bodies are retained. */
|
|
2
|
+
const invocations = new WeakMap();
|
|
3
|
+
export function trackDispatch(signal) {
|
|
4
|
+
const evidence = { attempted: false };
|
|
5
|
+
invocations.set(signal, evidence);
|
|
6
|
+
return evidence;
|
|
7
|
+
}
|
|
8
|
+
export function inheritDispatch(request, signal) {
|
|
9
|
+
const evidence = signal && invocations.get(signal);
|
|
10
|
+
if (evidence)
|
|
11
|
+
invocations.set(request.signal, evidence);
|
|
12
|
+
return request;
|
|
13
|
+
}
|
|
14
|
+
export function markDispatch(signal) {
|
|
15
|
+
const evidence = invocations.get(signal);
|
|
16
|
+
if (evidence)
|
|
17
|
+
evidence.attempted = true;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=dispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,MAAM,WAAW,GAAG,IAAI,OAAO,EAAuC,CAAC;AAEvE,MAAM,UAAU,aAAa,CAAC,MAAmB;IAC/C,MAAM,QAAQ,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACtC,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,OAAgB,EAChB,MAA+B;IAE/B,MAAM,QAAQ,GAAG,MAAM,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACnD,IAAI,QAAQ;QAAE,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACxD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAmB;IAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACzC,IAAI,QAAQ;QAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC;AAC1C,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -6,17 +6,39 @@ export declare class ApiError extends Error {
|
|
|
6
6
|
readonly requestId: string | null;
|
|
7
7
|
readonly retryAfter: string | null;
|
|
8
8
|
readonly name: string;
|
|
9
|
-
constructor(status: number, code: string, message: string, details: Record<string, unknown>, requestId: string | null, retryAfter?: string | null);
|
|
9
|
+
constructor(status: number, code: string, message: string, details: Record<string, unknown>, requestId: string | null, retryAfter?: string | null, cause?: unknown);
|
|
10
10
|
}
|
|
11
11
|
export declare class ProtocolError extends Error {
|
|
12
12
|
readonly name = "ProtocolError";
|
|
13
13
|
}
|
|
14
|
+
/** An attempted mutation has no reliable acknowledgement. Never automatically replay it. */
|
|
15
|
+
export declare class SubmissionUnknownError extends Error {
|
|
16
|
+
readonly idempotencyKey: string;
|
|
17
|
+
readonly operation: "start" | "send" | "resume";
|
|
18
|
+
readonly identities: Readonly<{
|
|
19
|
+
agentId?: string;
|
|
20
|
+
threadId?: string;
|
|
21
|
+
runId?: string;
|
|
22
|
+
}>;
|
|
23
|
+
readonly name = "SubmissionUnknownError";
|
|
24
|
+
constructor(idempotencyKey: string, operation: "start" | "send" | "resume", identities: Readonly<{
|
|
25
|
+
agentId?: string;
|
|
26
|
+
threadId?: string;
|
|
27
|
+
runId?: string;
|
|
28
|
+
}>, cause: unknown);
|
|
29
|
+
}
|
|
30
|
+
/** Preview stopped because faithful root assistant text can no longer be projected. */
|
|
31
|
+
export declare class PreviewInterruptedError extends Error {
|
|
32
|
+
readonly name = "PreviewInterruptedError";
|
|
33
|
+
constructor(message: string, cause?: unknown);
|
|
34
|
+
}
|
|
14
35
|
export declare class WaitTimeoutError extends Error {
|
|
15
36
|
readonly timeoutMs: number;
|
|
16
37
|
readonly name = "WaitTimeoutError";
|
|
17
38
|
constructor(timeoutMs: number);
|
|
18
39
|
}
|
|
19
40
|
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
41
|
+
export declare function isServiceRejection(error: unknown): error is ApiError;
|
|
20
42
|
export declare function requireSuccess(response: Response): Promise<void>;
|
|
21
43
|
/** Extract a required representation; 204 operations should await their response directly. */
|
|
22
44
|
export declare function data<T>(result: {
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,qBAAa,QAAS,SAAQ,KAAK;IAG/B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAPpC,SAAkB,IAAI,EAAE,MAAM,CAAc;gBAEjC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACN,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,UAAU,GAAE,MAAM,GAAG,IAAW;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,qBAAa,QAAS,SAAQ,KAAK;IAG/B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAPpC,SAAkB,IAAI,EAAE,MAAM,CAAc;gBAEjC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACN,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,UAAU,GAAE,MAAM,GAAG,IAAW,EACzC,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AC,CAkCtE;AAED,8FAA8F;AAC9F,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GAAG,CAAC,CAInE"}
|
package/dist/errors.js
CHANGED
|
@@ -6,8 +6,8 @@ export class ApiError extends Error {
|
|
|
6
6
|
requestId;
|
|
7
7
|
retryAfter;
|
|
8
8
|
name = "ApiError";
|
|
9
|
-
constructor(status, code, message, details, requestId, retryAfter = null) {
|
|
10
|
-
super(message);
|
|
9
|
+
constructor(status, code, message, details, requestId, retryAfter = null, cause) {
|
|
10
|
+
super(message, cause === undefined ? undefined : { cause });
|
|
11
11
|
this.status = status;
|
|
12
12
|
this.code = code;
|
|
13
13
|
this.details = details;
|
|
@@ -18,6 +18,26 @@ export class ApiError extends Error {
|
|
|
18
18
|
export class ProtocolError extends Error {
|
|
19
19
|
name = "ProtocolError";
|
|
20
20
|
}
|
|
21
|
+
/** An attempted mutation has no reliable acknowledgement. Never automatically replay it. */
|
|
22
|
+
export class SubmissionUnknownError extends Error {
|
|
23
|
+
idempotencyKey;
|
|
24
|
+
operation;
|
|
25
|
+
identities;
|
|
26
|
+
name = "SubmissionUnknownError";
|
|
27
|
+
constructor(idempotencyKey, operation, identities, cause) {
|
|
28
|
+
super(`The ${operation} submission outcome is unknown; retain its idempotency key for recovery.`, { cause });
|
|
29
|
+
this.idempotencyKey = idempotencyKey;
|
|
30
|
+
this.operation = operation;
|
|
31
|
+
this.identities = identities;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Preview stopped because faithful root assistant text can no longer be projected. */
|
|
35
|
+
export class PreviewInterruptedError extends Error {
|
|
36
|
+
name = "PreviewInterruptedError";
|
|
37
|
+
constructor(message, cause) {
|
|
38
|
+
super(message, { cause });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
21
41
|
export class WaitTimeoutError extends Error {
|
|
22
42
|
timeoutMs;
|
|
23
43
|
name = "WaitTimeoutError";
|
|
@@ -29,23 +49,36 @@ export class WaitTimeoutError extends Error {
|
|
|
29
49
|
export function isRecord(value) {
|
|
30
50
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
31
51
|
}
|
|
52
|
+
// A bare gateway status is not evidence that Service rejected a mutation.
|
|
53
|
+
const serviceRejections = new WeakSet();
|
|
54
|
+
export function isServiceRejection(error) {
|
|
55
|
+
return error instanceof ApiError && serviceRejections.has(error);
|
|
56
|
+
}
|
|
32
57
|
export async function requireSuccess(response) {
|
|
33
58
|
if (response.ok)
|
|
34
59
|
return;
|
|
35
60
|
let payload;
|
|
61
|
+
let failure;
|
|
36
62
|
try {
|
|
37
63
|
payload = await response.json();
|
|
38
64
|
}
|
|
39
|
-
catch {
|
|
65
|
+
catch (cause) {
|
|
66
|
+
failure = cause;
|
|
40
67
|
payload = null;
|
|
41
68
|
}
|
|
42
69
|
const error = isRecord(payload) && isRecord(payload.error) ? payload.error : {};
|
|
43
70
|
const code = typeof error.code === "string" ? error.code : "http_error";
|
|
44
|
-
|
|
71
|
+
const result = new ApiError(response.status, code, typeof error.message === "string"
|
|
45
72
|
? error.message
|
|
46
73
|
: `Service request failed (${response.status}).`, isRecord(error.details) ? error.details : {}, typeof error.request_id === "string"
|
|
47
74
|
? error.request_id
|
|
48
|
-
: response.headers.get("X-Request-ID"), response.headers.get("Retry-After"));
|
|
75
|
+
: response.headers.get("X-Request-ID"), response.headers.get("Retry-After"), failure);
|
|
76
|
+
if (typeof error.code === "string" &&
|
|
77
|
+
typeof error.message === "string" &&
|
|
78
|
+
isRecord(error.details) &&
|
|
79
|
+
(typeof error.request_id === "string" || error.request_id === null))
|
|
80
|
+
serviceRejections.add(result);
|
|
81
|
+
throw result;
|
|
49
82
|
}
|
|
50
83
|
/** Extract a required representation; 204 operations should await their response directly. */
|
|
51
84
|
export function data(result) {
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,OAAO,QAAS,SAAQ,KAAK;IAGtB;IACA;IAEA;IACA;IACA;IAPO,IAAI,GAAW,UAAU,CAAC;IAC5C,YACW,MAAc,EACd,IAAY,EACrB,OAAe,EACN,OAAgC,EAChC,SAAwB,EACxB,aAA4B,IAAI;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,OAAO,QAAS,SAAQ,KAAK;IAGtB;IACA;IAEA;IACA;IACA;IAPO,IAAI,GAAW,UAAU,CAAC;IAC5C,YACW,MAAc,EACd,IAAY,EACrB,OAAe,EACN,OAAgC,EAChC,SAAwB,EACxB,aAA4B,IAAI,EACzC,KAAe;QAEf,KAAK,CAAC,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QARnD,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QAEZ,YAAO,GAAP,OAAO,CAAyB;QAChC,cAAS,GAAT,SAAS,CAAe;QACxB,eAAU,GAAV,UAAU,CAAsB;IAI3C,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,KAAK;IACpB,IAAI,GAAG,eAAe,CAAC;CAC1C;AAED,4FAA4F;AAC5F,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAGpC;IACA;IACA;IAJO,IAAI,GAAG,wBAAwB,CAAC;IAClD,YACW,cAAsB,EACtB,SAAsC,EACtC,UAIP,EACF,KAAc;QAEd,KAAK,CACH,OAAO,SAAS,0EAA0E,EAC1F,EAAE,KAAK,EAAE,CACV,CAAC;QAZO,mBAAc,GAAd,cAAc,CAAQ;QACtB,cAAS,GAAT,SAAS,CAA6B;QACtC,eAAU,GAAV,UAAU,CAIjB;IAOJ,CAAC;CACF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Client } from "./client.js";
|
|
|
2
2
|
export type { Client } from "./client.js";
|
|
3
3
|
export { ServiceResources } from "./resources/generated.js";
|
|
4
4
|
export type { ClientOptions, Authentication } from "./transport.js";
|
|
5
|
-
export { ApiError, ProtocolError, WaitTimeoutError, data } from "./errors.js";
|
|
5
|
+
export { ApiError, ProtocolError, WaitTimeoutError, PreviewInterruptedError, SubmissionUnknownError, data, } from "./errors.js";
|
|
6
6
|
export type { ThreadEvent, ThreadStreamFrame, ThreadStreamOptions, } from "./streams/thread-stream.js";
|
|
7
|
+
export { sessionStream } from "./streams/session-stream.js";
|
|
8
|
+
export type { SessionStreamOptions } from "./streams/session-stream.js";
|
|
9
|
+
export type { SessionStreamFrame, SessionStreamSchemas, } from "./session-stream-schema.js";
|
|
7
10
|
export type { BinaryResult, ResourceResult } from "./resources/base.js";
|
|
8
11
|
export { textPayload } from "./resources/interaction.js";
|
|
9
12
|
export type { WaitOptions } from "./resources/interaction.js";
|
|
10
13
|
export { AgentHandle, ThreadHandle, EntryHandle, Interaction, RunHandle, RunOutcome, SubmissionDispositionError, } from "./semantic.js";
|
|
11
|
-
export type {
|
|
14
|
+
export type { InteractionIdentity } from "./semantic.js";
|
|
15
|
+
export { text, json, url, asset, approve, deny, returned, failed, } from "./workflow.js";
|
|
16
|
+
export type { MessageInput, MessagePayload, InputPart, StartOptions, SendOptions, ResumeOptions, SubmissionOptions, ResumeAnswer, ResumeAnswers, ExecutionOverride, ToolExecutionOverride, RunOptions, RunConfiguration, AgentOverride, MemoryMount, EnvironmentMounts, McpHeaders, MessageHistory, PendingCall, RunStatus, Failure, } from "./workflow.js";
|
|
12
17
|
export type { paths, components, operations, Binary } from "./schema.js";
|
|
13
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAA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EACL,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,YAAY,EACZ,cAAc,EACd,SAAS,EACT,YAAY,EACZ,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { createClient } from "./client.js";
|
|
2
2
|
export { ServiceResources } from "./resources/generated.js";
|
|
3
|
-
export { ApiError, ProtocolError, WaitTimeoutError, data } from "./errors.js";
|
|
3
|
+
export { ApiError, ProtocolError, WaitTimeoutError, PreviewInterruptedError, SubmissionUnknownError, data, } from "./errors.js";
|
|
4
|
+
export { sessionStream } from "./streams/session-stream.js";
|
|
4
5
|
export { textPayload } from "./resources/interaction.js";
|
|
5
6
|
export { AgentHandle, ThreadHandle, EntryHandle, Interaction, RunHandle, RunOutcome, SubmissionDispositionError, } from "./semantic.js";
|
|
7
|
+
export { text, json, url, asset, approve, deny, returned, failed, } from "./workflow.js";
|
|
6
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EACL,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,IAAI,GACL,MAAM,aAAa,CAAC;AAMrB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAO5D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,WAAW,EACX,SAAS,EACT,UAAU,EACV,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,KAAK,EACL,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,MAAM,GACP,MAAM,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/resources/base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/resources/base.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACjB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IACtD,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CAClC;AAMD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,SAAa,GAAG,MAAM,CAIjE;AAED,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,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GAAG,CAAC,CAEvC;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1D,OAAO,EAAE,CAAC,EACV,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAChC,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAMhC"}
|
package/dist/resources/base.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProtocolError } from "../errors.js";
|
|
2
|
+
import { inheritDispatch } from "../dispatch.js";
|
|
2
3
|
function requestSignal(signal) {
|
|
3
4
|
return signal ?? new AbortController().signal;
|
|
4
5
|
}
|
|
@@ -37,7 +38,7 @@ export async function jsonRequest(transport, method, path, body, headers, option
|
|
|
37
38
|
};
|
|
38
39
|
if (hasBody)
|
|
39
40
|
init.body = JSON.stringify(body);
|
|
40
|
-
const response = await transport.fetch(new Request(`${transport.baseUrl}${withQuery(path, options.query)}`, init));
|
|
41
|
+
const response = await transport.fetch(inheritDispatch(new Request(`${transport.baseUrl}${withQuery(path, options.query)}`, init), options.signal));
|
|
41
42
|
if (response.status === 204 || response.status === 205)
|
|
42
43
|
return { data: undefined, response };
|
|
43
44
|
const text = await response.text();
|
|
@@ -118,7 +119,7 @@ export async function uploadRequest(transport, method, path, body, contentType,
|
|
|
118
119
|
};
|
|
119
120
|
if (body instanceof ReadableStream)
|
|
120
121
|
init.duplex = "half";
|
|
121
|
-
const response = await transport.fetch(new Request(`${transport.baseUrl}${withQuery(path, options.query)}`, init));
|
|
122
|
+
const response = await transport.fetch(inheritDispatch(new Request(`${transport.baseUrl}${withQuery(path, options.query)}`, init), options.signal));
|
|
122
123
|
const text = await response.text();
|
|
123
124
|
if (!text)
|
|
124
125
|
return { data: undefined, response };
|
|
@@ -215,6 +216,8 @@ export function withCursor(filters, cursor) {
|
|
|
215
216
|
delete copy.cursor;
|
|
216
217
|
else
|
|
217
218
|
copy.cursor = cursor;
|
|
219
|
+
if (cursor != null)
|
|
220
|
+
delete copy.anchor;
|
|
218
221
|
return copy;
|
|
219
222
|
}
|
|
220
223
|
//# sourceMappingURL=base.js.map
|