@abelxiaoxing/cadence 2.0.35 → 2.0.36
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.de.md +2 -2
- package/README.es.md +2 -2
- package/README.fr.md +2 -2
- package/README.ja.md +1 -2
- package/README.ko.md +2 -2
- package/README.md +2 -2
- package/README.pt-BR.md +2 -2
- package/README.ru.md +3 -2
- package/README.zh-CN.md +2 -2
- package/docs/conversation-mode.md +18 -0
- package/package.json +6 -11
- package/src/abort-scope.ts +47 -0
- package/src/native-build.ts +1 -1
- package/src/service-host.mjs +4 -4
- package/src/service-http-client.ts +55 -50
- package/web/dist/assets/cadence.js +13 -13
- package/web/dist/manifest.json +5 -5
package/README.de.md
CHANGED
|
@@ -108,11 +108,11 @@ Cadence erzwingt keinen Pi-Versionsbereich; Entwicklungs-Pins und getestete Lauf
|
|
|
108
108
|
```sh
|
|
109
109
|
bun install
|
|
110
110
|
bun run verify
|
|
111
|
-
CADENCE_BROWSER_PATH=/absolute/existing/chromium bun run verify:full
|
|
112
111
|
```
|
|
113
112
|
|
|
114
113
|
Engineering-Anleitungen sind unter [engineering/](engineering/) nach Bereich aufgeteilt; der Projektindex in [AGENTS.md](AGENTS.md) sagt, welche Datei welchen Code abdeckt.
|
|
115
|
-
`verify`
|
|
114
|
+
`verify` ist die einzige Prüfung für Entwicklung und Releases: nur schnelle Checks, ohne Browser.
|
|
115
|
+
Erforderlich sind ein offizieller Node-Build und ein privates temporäres Verzeichnis; siehe [Verifikation](engineering/verification.md).
|
|
116
116
|
|
|
117
117
|
## Lizenz
|
|
118
118
|
|
package/README.es.md
CHANGED
|
@@ -108,11 +108,11 @@ Cadence no impone un rango de versiones de Pi; los pines de desarrollo y los tie
|
|
|
108
108
|
```sh
|
|
109
109
|
bun install
|
|
110
110
|
bun run verify
|
|
111
|
-
CADENCE_BROWSER_PATH=/absolute/existing/chromium bun run verify:full
|
|
112
111
|
```
|
|
113
112
|
|
|
114
113
|
La guía de ingeniería se divide por área bajo [engineering/](engineering/); el índice del proyecto en [AGENTS.md](AGENTS.md) indica qué archivo cubre qué código.
|
|
115
|
-
`verify`
|
|
114
|
+
`verify` es la única verificación para desarrollo y publicación: solo comprobaciones rápidas, sin navegador.
|
|
115
|
+
Requiere un build oficial de Node y un directorio temporal privado; ver [verificación](engineering/verification.md).
|
|
116
116
|
|
|
117
117
|
## Licencia
|
|
118
118
|
|
package/README.fr.md
CHANGED
|
@@ -108,11 +108,11 @@ Cadence n'impose pas de plage de versions de Pi ; les versions figées de dével
|
|
|
108
108
|
```sh
|
|
109
109
|
bun install
|
|
110
110
|
bun run verify
|
|
111
|
-
CADENCE_BROWSER_PATH=/absolute/existing/chromium bun run verify:full
|
|
112
111
|
```
|
|
113
112
|
|
|
114
113
|
Les conseils d'ingénierie sont répartis par domaine sous [engineering/](engineering/) ; l'index du projet dans [AGENTS.md](AGENTS.md) indique quel fichier couvre quel code.
|
|
115
|
-
`verify`
|
|
114
|
+
`verify` est la seule validation pour le développement et les publications : uniquement des vérifications rapides, sans navigateur.
|
|
115
|
+
Elle nécessite un build Node officiel et un répertoire temporaire privé ; voir [vérification](engineering/verification.md).
|
|
116
116
|
|
|
117
117
|
## Licence
|
|
118
118
|
|
package/README.ja.md
CHANGED
|
@@ -127,13 +127,12 @@ Cadence は Pi のバージョン範囲を強制しない。
|
|
|
127
127
|
```sh
|
|
128
128
|
bun install
|
|
129
129
|
bun run verify
|
|
130
|
-
CADENCE_BROWSER_PATH=/absolute/existing/chromium bun run verify:full
|
|
131
130
|
```
|
|
132
131
|
|
|
133
132
|
エンジニアリングのガイダンスは [engineering/](engineering/) 下に領域ごとに分割されている。
|
|
134
133
|
[AGENTS.md](AGENTS.md) のプロジェクト索引がどのファイルがどのコードをカバーするかを示す。
|
|
135
134
|
`verify` には公式 Node ビルドとプライベートな一時ディレクトリが必要。
|
|
136
|
-
|
|
135
|
+
`verify` は開発とリリース共通の唯一の検証コマンドで、高速なチェックのみを実行し、ブラウザは不要。
|
|
137
136
|
[検証](engineering/verification.md)を参照。
|
|
138
137
|
|
|
139
138
|
## ライセンス
|
package/README.ko.md
CHANGED
|
@@ -124,12 +124,12 @@ Cadence는 Pi 버전 범위를 강제하지 않습니다.
|
|
|
124
124
|
```sh
|
|
125
125
|
bun install
|
|
126
126
|
bun run verify
|
|
127
|
-
CADENCE_BROWSER_PATH=/absolute/existing/chromium bun run verify:full
|
|
128
127
|
```
|
|
129
128
|
|
|
130
129
|
엔지니어링 지침은 [engineering/](engineering/) 아래 영역별로 나뉘어 있습니다.
|
|
131
130
|
[AGENTS.md](AGENTS.md)의 프로젝트 인덱스가 어느 파일이 어느 코드를 다루는지 설명합니다.
|
|
132
|
-
`verify
|
|
131
|
+
`verify`는 개발과 릴리스에 사용하는 유일한 검증 명령으로, 빠른 검사만 실행하며 브라우저가 필요하지 않습니다.
|
|
132
|
+
공식 Node 빌드와 개인 임시 디렉터리가 필요합니다.
|
|
133
133
|
[검증](engineering/verification.md)을 참조하세요.
|
|
134
134
|
|
|
135
135
|
## 라이선스
|
package/README.md
CHANGED
|
@@ -113,11 +113,11 @@ Cadence does not impose a Pi version range; development pins and tested runtimes
|
|
|
113
113
|
```sh
|
|
114
114
|
bun install
|
|
115
115
|
bun run verify
|
|
116
|
-
CADENCE_BROWSER_PATH=/absolute/existing/chromium bun run verify:full
|
|
117
116
|
```
|
|
118
117
|
|
|
119
118
|
Engineering guidance is split by area under [engineering/](engineering/); the project index in [AGENTS.md](AGENTS.md) says which file covers which code.
|
|
120
|
-
`verify`
|
|
119
|
+
`verify` is the single development and release gate: fast checks only, with no browser requirement.
|
|
120
|
+
It needs an official Node build and a private temporary directory; see [verification](engineering/verification.md).
|
|
121
121
|
|
|
122
122
|
## License
|
|
123
123
|
|
package/README.pt-BR.md
CHANGED
|
@@ -108,11 +108,11 @@ O Cadence não impõe uma faixa de versões do Pi; fixações de desenvolvimento
|
|
|
108
108
|
```sh
|
|
109
109
|
bun install
|
|
110
110
|
bun run verify
|
|
111
|
-
CADENCE_BROWSER_PATH=/absolute/existing/chromium bun run verify:full
|
|
112
111
|
```
|
|
113
112
|
|
|
114
113
|
As orientações de engenharia são divididas por área sob [engineering/](engineering/); o índice do projeto em [AGENTS.md](AGENTS.md) diz qual arquivo cobre qual código.
|
|
115
|
-
`verify`
|
|
114
|
+
`verify` é a única verificação para desenvolvimento e publicação: apenas verificações rápidas, sem navegador.
|
|
115
|
+
Exige um build oficial do Node e um diretório temporário privado; veja [verificação](engineering/verification.md).
|
|
116
116
|
|
|
117
117
|
## Licença
|
|
118
118
|
|
package/README.ru.md
CHANGED
|
@@ -108,12 +108,13 @@ Cadence не налагает диапазон версий Pi; фиксиров
|
|
|
108
108
|
```sh
|
|
109
109
|
bun install
|
|
110
110
|
bun run verify
|
|
111
|
-
CADENCE_BROWSER_PATH=/absolute/existing/chromium bun run verify:full
|
|
112
111
|
```
|
|
113
112
|
|
|
114
113
|
Инженерные указания разделены по областям в [engineering/](engineering/).
|
|
115
114
|
Индекс проекта в [AGENTS.md](AGENTS.md) указывает, какой файл покрывает какой код.
|
|
116
|
-
`verify`
|
|
115
|
+
`verify` — единственная проверка для разработки и публикации: только быстрые проверки, без браузера.
|
|
116
|
+
Нужны официальная сборка Node и приватный временный каталог; см.
|
|
117
|
+
[проверки](engineering/verification.md).
|
|
117
118
|
|
|
118
119
|
## Лицензия
|
|
119
120
|
|
package/README.zh-CN.md
CHANGED
|
@@ -108,11 +108,11 @@ Cadence 不指定 Pi 版本范围;开发用的固定版本和已测试运行
|
|
|
108
108
|
```sh
|
|
109
109
|
bun install
|
|
110
110
|
bun run verify
|
|
111
|
-
CADENCE_BROWSER_PATH=/absolute/existing/chromium bun run verify:full
|
|
112
111
|
```
|
|
113
112
|
|
|
114
113
|
工程指导按领域拆分在 [engineering/](engineering/) 下;[AGENTS.md](AGENTS.md) 中的项目索引说明了哪个文件覆盖哪部分代码。
|
|
115
|
-
`verify`
|
|
114
|
+
`verify` 是开发和发布共用的唯一验证入口:只运行快速检查,不需要浏览器。
|
|
115
|
+
需要官方 Node 构建和私有临时目录;见[验证](engineering/verification.md)。
|
|
116
116
|
|
|
117
117
|
## 许可证
|
|
118
118
|
|
|
@@ -32,6 +32,24 @@ Opening a different conversation does not enable Cadence there.
|
|
|
32
32
|
Restore never replays a command or automatically resumes an interrupted queue.
|
|
33
33
|
When an observation reply is lost, ask for status; do not infer that the action was absent.
|
|
34
34
|
|
|
35
|
+
## Resume a sent conversation on another device
|
|
36
|
+
|
|
37
|
+
Open the same authenticated workbench on the other device with the **complete conversation link**: `/app?project=<project-key>#chat=<session-id>`.
|
|
38
|
+
The project and chat identities in that link select the same server-held conversation even with empty or blocked browser storage.
|
|
39
|
+
Its sent history, Cadence mode, working directory, model preference and linked work come from the service, not from the first device's pending-send display.
|
|
40
|
+
A link grants neither access nor plan approval: authenticate normally and make any new execution confirmation explicitly.
|
|
41
|
+
Without that complete link, the other browser is not promised an automatic return to the first browser's last conversation.
|
|
42
|
+
|
|
43
|
+
Opening the link only observes; browsing never prepares or starts the project's execution service.
|
|
44
|
+
Only an explicit **Send** may prepare it on demand.
|
|
45
|
+
Leaving, closing or disconnecting a viewer does not cancel accepted work; reconnecting does not resend a message, resume an interrupted queue or inherit approval.
|
|
46
|
+
A stale or unavailable observation keeps readable history but cannot establish that work stopped; distinguish connection freshness from the workflow's last observed status.
|
|
47
|
+
|
|
48
|
+
Unsent text and images are not synchronized across devices.
|
|
49
|
+
Text drafts are local to that browser session when storage is available; images remain local to the tab.
|
|
50
|
+
A preparation failure keeps the local draft and explains whether preparation was never dispatched, is unconfirmed, or was confirmed before a later wait failed.
|
|
51
|
+
An uncertain final Send keeps its original command identity for observation only: do not send it again merely because its reply was lost.
|
|
52
|
+
|
|
35
53
|
## Images in the WebUI
|
|
36
54
|
|
|
37
55
|
Use **Add images**, paste a screenshot, or drop image files onto the composer.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abelxiaoxing/cadence",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.36",
|
|
4
4
|
"description": "Conversation-driven Pi workspace: persistent native and WebUI workflows, explicit plan approval, checks and local delivery.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"skills",
|
|
18
18
|
"config",
|
|
19
19
|
"agents",
|
|
20
|
+
"src/abort-scope.ts",
|
|
20
21
|
"src/agent-panel-cadence.ts",
|
|
21
22
|
"src/agent-panel-model.ts",
|
|
22
23
|
"src/agent-panel.ts",
|
|
@@ -96,13 +97,10 @@
|
|
|
96
97
|
"pack:check": "node scripts/pack-check.mjs",
|
|
97
98
|
"traceability:check": "node scripts/traceability-check.mjs",
|
|
98
99
|
"verify": "node scripts/verify.mjs",
|
|
99
|
-
"verify:full": "node scripts/verify.mjs --full",
|
|
100
100
|
"check": "node scripts/check-syntax.mjs && bun scripts/build-operator.mjs --check && bun scripts/build-service.mjs --check && tsc --noEmit --incremental --tsBuildInfoFile .cache/tsc/root.tsbuildinfo",
|
|
101
101
|
"lint": "biome check . && rumdl check .",
|
|
102
|
-
"test": "vitest run",
|
|
103
|
-
"test:
|
|
104
|
-
"test:slow": "vitest run --tags-filter=slow",
|
|
105
|
-
"test:target": "vitest run",
|
|
102
|
+
"test": "vitest run --tags-filter=!slow",
|
|
103
|
+
"test:target": "vitest run --tags-filter=!slow",
|
|
106
104
|
"check:agents": "node scripts/check-agents.mjs",
|
|
107
105
|
"doctor": "node src/operator-cli.mjs doctor",
|
|
108
106
|
"runs": "node src/operator-cli.mjs runs",
|
|
@@ -112,10 +110,8 @@
|
|
|
112
110
|
"test:web": "vitest run --config web/vitest.config.ts",
|
|
113
111
|
"build:web": "node scripts/build-web.mjs",
|
|
114
112
|
"build:web:check": "node scripts/build-web.mjs --check",
|
|
115
|
-
"test:web:assets-browser": "bun run test:browser",
|
|
116
113
|
"build:check": "bun scripts/build-operator.mjs --check && bun scripts/build-service.mjs --check && bun run build:web:check",
|
|
117
|
-
"test:service": "vitest run --config test/service.config.ts",
|
|
118
|
-
"test:browser": "vitest run --config web/browser.config.ts",
|
|
114
|
+
"test:service": "vitest run --config test/service.config.ts --tags-filter=!slow",
|
|
119
115
|
"check:notices": "node scripts/audit-notices.mjs"
|
|
120
116
|
},
|
|
121
117
|
"peerDependencies": {
|
|
@@ -154,8 +150,7 @@
|
|
|
154
150
|
"mdast-util-math": "3.0.0",
|
|
155
151
|
"vis-timeline": "8.5.4",
|
|
156
152
|
"vite": "8.3.0",
|
|
157
|
-
"@vitejs/plugin-react": "6.1.1"
|
|
158
|
-
"playwright-core": "1.63.0"
|
|
153
|
+
"@vitejs/plugin-react": "6.1.1"
|
|
159
154
|
},
|
|
160
155
|
"repository": {
|
|
161
156
|
"type": "git",
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** A local wait's cancellation lifetime, not ownership of the operation it
|
|
2
|
+
* observes. No static AbortSignal APIs or global polyfill are required. */
|
|
3
|
+
export function abortScope(
|
|
4
|
+
sources: readonly (AbortSignal | undefined)[] = [],
|
|
5
|
+
timeoutMs?: number,
|
|
6
|
+
): { signal: AbortSignal; dispose(): void } {
|
|
7
|
+
if (
|
|
8
|
+
timeoutMs !== undefined &&
|
|
9
|
+
(!Number.isFinite(timeoutMs) || timeoutMs < 0 || timeoutMs > 2_147_483_647)
|
|
10
|
+
)
|
|
11
|
+
throw new RangeError("invalid abort timeout");
|
|
12
|
+
const controller = new AbortController();
|
|
13
|
+
const listeners = new Map<AbortSignal, () => void>();
|
|
14
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
15
|
+
let disposed = false;
|
|
16
|
+
const dispose = () => {
|
|
17
|
+
if (disposed) return;
|
|
18
|
+
disposed = true;
|
|
19
|
+
clearTimeout(timer);
|
|
20
|
+
for (const [source, listener] of listeners)
|
|
21
|
+
source.removeEventListener("abort", listener);
|
|
22
|
+
listeners.clear();
|
|
23
|
+
};
|
|
24
|
+
const abort = (reason: unknown) => {
|
|
25
|
+
if (disposed) return;
|
|
26
|
+
dispose();
|
|
27
|
+
controller.abort(reason);
|
|
28
|
+
};
|
|
29
|
+
for (const source of sources) {
|
|
30
|
+
if (!source || listeners.has(source)) continue;
|
|
31
|
+
if (source.aborted) {
|
|
32
|
+
abort(source.reason);
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
const listener = () => abort(source.reason);
|
|
36
|
+
listeners.set(source, listener);
|
|
37
|
+
source.addEventListener("abort", listener, { once: true });
|
|
38
|
+
}
|
|
39
|
+
if (!disposed && timeoutMs !== undefined)
|
|
40
|
+
timer = setTimeout(
|
|
41
|
+
() => abort(new DOMException("The wait timed out", "TimeoutError")),
|
|
42
|
+
timeoutMs,
|
|
43
|
+
);
|
|
44
|
+
// Disposal only releases listeners/timers. It never aborts a source, sends
|
|
45
|
+
// Cancel, or changes the admitted work's lifetime.
|
|
46
|
+
return { signal: controller.signal, dispose };
|
|
47
|
+
}
|
package/src/native-build.ts
CHANGED
package/src/service-host.mjs
CHANGED
|
@@ -14542,7 +14542,7 @@ async function createGateway(value, hostUrl, source) {
|
|
|
14542
14542
|
const input = decodeGatewayInput(value), store = new GatewayStore(input.serverConfig, input.stateHome);
|
|
14543
14543
|
const web = loadWebAssets(source?.webDirectory);
|
|
14544
14544
|
const build2 = {
|
|
14545
|
-
contractHash: "
|
|
14545
|
+
contractHash: "2d78a97c9d5db70709e390e26fa315b5fdd3539f5a36e040593943f06ee5469a",
|
|
14546
14546
|
assets: {
|
|
14547
14547
|
sourceHash: web.manifest.sourceHash,
|
|
14548
14548
|
contractHash: web.manifest.contractHash,
|
|
@@ -29167,8 +29167,8 @@ function workflowResultDetail(value, secrets) {
|
|
|
29167
29167
|
|
|
29168
29168
|
// src/service/workflows.ts
|
|
29169
29169
|
var OWNER_RUNTIME = Object.freeze({
|
|
29170
|
-
version: "2.0.
|
|
29171
|
-
build: "
|
|
29170
|
+
version: "2.0.36",
|
|
29171
|
+
build: "a996fe94021d7ae65c3e8da45de2b5e98de031d12bb91a3bc029acdacdd9e8a5",
|
|
29172
29172
|
entry: fileURLToPath6(import.meta.url),
|
|
29173
29173
|
pid: process.pid,
|
|
29174
29174
|
node: process.versions.node,
|
|
@@ -31106,7 +31106,7 @@ var processLifetime = {
|
|
|
31106
31106
|
}
|
|
31107
31107
|
};
|
|
31108
31108
|
async function createServiceHost(value, sourceBuild, lifetime) {
|
|
31109
|
-
const embedded = "
|
|
31109
|
+
const embedded = "2d78a97c9d5db70709e390e26fa315b5fdd3539f5a36e040593943f06ee5469a";
|
|
31110
31110
|
if (embedded && sourceBuild)
|
|
31111
31111
|
throw new ContractError("unsupported-context");
|
|
31112
31112
|
const contractHash = decodeHash(embedded ?? sourceBuild?.contractHash);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { abortScope } from "./abort-scope.ts";
|
|
1
2
|
import type {
|
|
2
3
|
WorkbenchCommand,
|
|
3
4
|
WorkbenchRead,
|
|
@@ -129,60 +130,64 @@ export class HttpServiceTransport implements ServiceTransport {
|
|
|
129
130
|
write = wire.method === "POST";
|
|
130
131
|
// No automatic session/preflight refresh, changed command ID, mutation retry,
|
|
131
132
|
// credential query or redirect follow after an uncertain HTTP outcome.
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
credentials: "same-origin",
|
|
138
|
-
redirect: "error",
|
|
139
|
-
signal:
|
|
140
|
-
this.options.requestTimeoutMs === undefined
|
|
141
|
-
? signal
|
|
142
|
-
: AbortSignal.any([
|
|
143
|
-
...(signal ? [signal] : []),
|
|
144
|
-
AbortSignal.timeout(this.options.requestTimeoutMs),
|
|
145
|
-
]),
|
|
146
|
-
...(write ? { body: wire.body } : {}),
|
|
147
|
-
},
|
|
148
|
-
);
|
|
149
|
-
// Keep a known allocation even if its original response body is lost or
|
|
150
|
-
// malformed. Without a validated CSRF challenge detach may remain blocked;
|
|
151
|
-
// never silently forget that slot and acquire 16 replacement sessions.
|
|
152
|
-
let sessionAttachment: string | undefined;
|
|
133
|
+
const scope =
|
|
134
|
+
this.options.requestTimeoutMs === undefined
|
|
135
|
+
? undefined
|
|
136
|
+
: abortScope([signal], this.options.requestTimeoutMs);
|
|
137
|
+
const requestSignal = scope?.signal ?? signal;
|
|
153
138
|
try {
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
139
|
+
if (requestSignal?.aborted) throw requestSignal.reason;
|
|
140
|
+
const response = await this.fetcher(
|
|
141
|
+
`${this.origin}${this.options.project ? `/projects/${this.options.project}` : ""}${wire.path}`,
|
|
142
|
+
{
|
|
143
|
+
method: wire.method,
|
|
144
|
+
headers: this.headers(write),
|
|
145
|
+
credentials: "same-origin",
|
|
146
|
+
redirect: "error",
|
|
147
|
+
signal: requestSignal,
|
|
148
|
+
...(write ? { body: wire.body } : {}),
|
|
149
|
+
},
|
|
150
|
+
);
|
|
151
|
+
// Keep a known allocation even if its original response body is lost or
|
|
152
|
+
// malformed. Without a validated CSRF challenge detach may remain blocked;
|
|
153
|
+
// never silently forget that slot and acquire 16 replacement sessions.
|
|
154
|
+
let sessionAttachment: string | undefined;
|
|
155
|
+
try {
|
|
156
|
+
if (operation === "session" && response.ok) {
|
|
157
|
+
sessionAttachment = decodeId(
|
|
158
|
+
response.headers.get("x-cadence-attachment"),
|
|
159
|
+
);
|
|
160
|
+
this.attachment = sessionAttachment;
|
|
161
|
+
}
|
|
162
|
+
} catch (error) {
|
|
163
|
+
await response.body?.cancel().catch(() => {});
|
|
164
|
+
throw error;
|
|
159
165
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
sessionAttachment ??
|
|
181
|
-
decodeId(response.headers.get("x-cadence-attachment"));
|
|
182
|
-
this.csrf = reply.value.csrf;
|
|
166
|
+
const source = await boundedText(response, httpOutputLimit(operation)),
|
|
167
|
+
parsed = parseWireJson(source);
|
|
168
|
+
// Graph's category is known only after parsing. Count ORIGINAL wire bytes,
|
|
169
|
+
// not a canonical re-encoding which discards padding or alternate escapes.
|
|
170
|
+
if (utf8Bytes(source) > httpOutputLimit(operation, parsed))
|
|
171
|
+
throw new ContractError("oversize");
|
|
172
|
+
const result = decodeHttpOutput(operation, parsed);
|
|
173
|
+
if (operation === "session") {
|
|
174
|
+
const reply = decodeReply(result, decodeSessionBootstrap);
|
|
175
|
+
if (reply.kind === "ok") {
|
|
176
|
+
if (
|
|
177
|
+
(reply.value.authority === "local") !==
|
|
178
|
+
!!this.options.localCapability
|
|
179
|
+
)
|
|
180
|
+
throw new ContractError("forbidden");
|
|
181
|
+
this.attachment =
|
|
182
|
+
sessionAttachment ??
|
|
183
|
+
decodeId(response.headers.get("x-cadence-attachment"));
|
|
184
|
+
this.csrf = reply.value.csrf;
|
|
185
|
+
}
|
|
183
186
|
}
|
|
187
|
+
return result;
|
|
188
|
+
} finally {
|
|
189
|
+
scope?.dispose();
|
|
184
190
|
}
|
|
185
|
-
return result;
|
|
186
191
|
}
|
|
187
192
|
session(signal?: AbortSignal) {
|
|
188
193
|
return this.request("session", null, signal);
|