@pi-in-go/pigpen-ahp 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/CREDITS.md +27 -0
- package/LICENSE +23 -0
- package/README.md +148 -0
- package/extensions/ahp/access_options_test.go +116 -0
- package/extensions/ahp/extension.go +54 -0
- package/extensions/ahp/go.mod +12 -0
- package/extensions/ahp/go.sum +2 -0
- package/extensions/ahp/go.work +8 -0
- package/extensions/ahp/internal/channels/chat.go +110 -0
- package/extensions/ahp/internal/channels/root.go +32 -0
- package/extensions/ahp/internal/channels/session.go +128 -0
- package/extensions/ahp/internal/channels/session_test.go +108 -0
- package/extensions/ahp/internal/compose/compose.go +153 -0
- package/extensions/ahp/internal/compose/compose_test.go +120 -0
- package/extensions/ahp/internal/gaps/gaps_test.go +88 -0
- package/extensions/ahp/internal/host/handshake_test.go +206 -0
- package/extensions/ahp/internal/host/host.go +1305 -0
- package/extensions/ahp/internal/host/reconnect_test.go +197 -0
- package/extensions/ahp/internal/host/replaywindow_test.go +31 -0
- package/extensions/ahp/internal/host/schema_test.go +79 -0
- package/extensions/ahp/internal/host/store.go +291 -0
- package/extensions/ahp/internal/host/store_update_test.go +85 -0
- package/extensions/ahp/internal/host/subscriptions_test.go +160 -0
- package/extensions/ahp/internal/host/surface_test.go +95 -0
- package/extensions/ahp/internal/host/workarounds.go +458 -0
- package/extensions/ahp/internal/host/workarounds_test.go +96 -0
- package/extensions/ahp/internal/live/live.go +328 -0
- package/extensions/ahp/internal/live/live_test.go +91 -0
- package/extensions/ahp/internal/live/store.go +113 -0
- package/extensions/ahp/internal/mapper/activity.go +199 -0
- package/extensions/ahp/internal/mapper/activity_test.go +188 -0
- package/extensions/ahp/internal/mapper/bench_test.go +38 -0
- package/extensions/ahp/internal/mapper/event_mapper_test.go +380 -0
- package/extensions/ahp/internal/mapper/fixtures_test.go +387 -0
- package/extensions/ahp/internal/mapper/helpers_test.go +251 -0
- package/extensions/ahp/internal/mapper/js.go +131 -0
- package/extensions/ahp/internal/mapper/mapper.go +600 -0
- package/extensions/ahp/internal/mapper/message_input_test.go +196 -0
- package/extensions/ahp/internal/mapper/messageinput.go +272 -0
- package/extensions/ahp/internal/mapper/schema_helpers_test.go +5 -0
- package/extensions/ahp/internal/mapper/testdata/LICENSE-pi-ahp +21 -0
- package/extensions/ahp/internal/mapper/testdata/fixtures/abort.json +711 -0
- package/extensions/ahp/internal/mapper/testdata/fixtures/bash-long-output.json +1312 -0
- package/extensions/ahp/internal/mapper/testdata/fixtures/compaction.json +6285 -0
- package/extensions/ahp/internal/mapper/testdata/fixtures/parallel-tools.json +2622 -0
- package/extensions/ahp/internal/mapper/testdata/fixtures/plain-text.json +1856 -0
- package/extensions/ahp/internal/mapper/testdata/fixtures/single-tool.json +1128 -0
- package/extensions/ahp/internal/mapper/testdata/fixtures/steering.json +3926 -0
- package/extensions/ahp/internal/mapper/testdata/fixtures/tool-bash.json +2372 -0
- package/extensions/ahp/internal/mapper/testdata/fixtures/tool-edit.json +3983 -0
- package/extensions/ahp/internal/mapper/testdata/fixtures/tool-error.json +2850 -0
- package/extensions/ahp/internal/mapper/testdata/fixtures/tool-find.json +1162 -0
- package/extensions/ahp/internal/mapper/testdata/fixtures/tool-grep.json +2783 -0
- package/extensions/ahp/internal/mapper/testdata/fixtures/tool-loop.json +1693 -0
- package/extensions/ahp/internal/mapper/testdata/fixtures/tool-ls.json +2427 -0
- package/extensions/ahp/internal/mapper/testdata/fixtures/tool-write.json +1271 -0
- package/extensions/ahp/internal/mapper/title.go +34 -0
- package/extensions/ahp/internal/mapper/usermsg.go +87 -0
- package/extensions/ahp/internal/pi/activeturn_test.go +296 -0
- package/extensions/ahp/internal/pi/backend.go +64 -0
- package/extensions/ahp/internal/pi/catalogue.go +370 -0
- package/extensions/ahp/internal/pi/catalogue_test.go +271 -0
- package/extensions/ahp/internal/pi/chatdriver.go +533 -0
- package/extensions/ahp/internal/pi/chatdriver_test.go +416 -0
- package/extensions/ahp/internal/pi/clientactions.go +212 -0
- package/extensions/ahp/internal/pi/clientactions_test.go +273 -0
- package/extensions/ahp/internal/pi/completions.go +230 -0
- package/extensions/ahp/internal/pi/completions_test.go +272 -0
- package/extensions/ahp/internal/pi/config_test.go +269 -0
- package/extensions/ahp/internal/pi/deletesession.go +69 -0
- package/extensions/ahp/internal/pi/deletesession_test.go +153 -0
- package/extensions/ahp/internal/pi/disposal_test.go +362 -0
- package/extensions/ahp/internal/pi/fixture_test.go +308 -0
- package/extensions/ahp/internal/pi/foreign_test.go +122 -0
- package/extensions/ahp/internal/pi/harness_test.go +83 -0
- package/extensions/ahp/internal/pi/history.go +269 -0
- package/extensions/ahp/internal/pi/hydrated_test.go +171 -0
- package/extensions/ahp/internal/pi/hydratedlifecycle_test.go +196 -0
- package/extensions/ahp/internal/pi/hydration_test.go +209 -0
- package/extensions/ahp/internal/pi/hydrator.go +212 -0
- package/extensions/ahp/internal/pi/imageinput.go +224 -0
- package/extensions/ahp/internal/pi/imageinput_test.go +57 -0
- package/extensions/ahp/internal/pi/lifecycle_test.go +381 -0
- package/extensions/ahp/internal/pi/models.go +212 -0
- package/extensions/ahp/internal/pi/models_test.go +128 -0
- package/extensions/ahp/internal/pi/paging.go +95 -0
- package/extensions/ahp/internal/pi/pagingtruncate_test.go +323 -0
- package/extensions/ahp/internal/pi/projecttrust.go +222 -0
- package/extensions/ahp/internal/pi/registry.go +924 -0
- package/extensions/ahp/internal/pi/restart_test.go +185 -0
- package/extensions/ahp/internal/pi/services.go +70 -0
- package/extensions/ahp/internal/pi/sessionconfig.go +64 -0
- package/extensions/ahp/internal/pi/sessionfiles_test.go +74 -0
- package/extensions/ahp/internal/pi/sessionstore.go +83 -0
- package/extensions/ahp/internal/pi/summary_test.go +426 -0
- package/extensions/ahp/internal/pi/workarounds_wire_test.go +208 -0
- package/extensions/ahp/internal/pisession/fromentries_test.go +32 -0
- package/extensions/ahp/internal/pisession/json.go +31 -0
- package/extensions/ahp/internal/pisession/pisession.go +580 -0
- package/extensions/ahp/internal/settings/access.go +63 -0
- package/extensions/ahp/internal/settings/access_test.go +52 -0
- package/extensions/ahp/internal/settings/settings.go +117 -0
- package/extensions/ahp/internal/settings/settings_test.go +104 -0
- package/extensions/ahp/internal/svc/etag_other.go +15 -0
- package/extensions/ahp/internal/svc/etag_unix.go +34 -0
- package/extensions/ahp/internal/svc/glob.go +197 -0
- package/extensions/ahp/internal/svc/mime.go +37 -0
- package/extensions/ahp/internal/svc/paths.go +108 -0
- package/extensions/ahp/internal/svc/pty.go +64 -0
- package/extensions/ahp/internal/svc/pty_darwin.go +42 -0
- package/extensions/ahp/internal/svc/pty_linux.go +36 -0
- package/extensions/ahp/internal/svc/pty_other.go +9 -0
- package/extensions/ahp/internal/svc/pty_test.go +114 -0
- package/extensions/ahp/internal/svc/pty_unix.go +147 -0
- package/extensions/ahp/internal/svc/resource.go +495 -0
- package/extensions/ahp/internal/svc/resource_test.go +501 -0
- package/extensions/ahp/internal/svc/stat_bsd.go +9 -0
- package/extensions/ahp/internal/svc/stat_linux.go +9 -0
- package/extensions/ahp/internal/svc/terminal.go +454 -0
- package/extensions/ahp/internal/svc/terminal_test.go +512 -0
- package/extensions/ahp/internal/svc/watch.go +590 -0
- package/extensions/ahp/internal/svc/watch_test.go +627 -0
- package/extensions/ahp/internal/svc/watchevents_test.go +452 -0
- package/extensions/ahp/internal/svc/watchpolicy.go +81 -0
- package/extensions/ahp/internal/svc/watchpolicy_test.go +151 -0
- package/extensions/ahp/internal/svc/watchracy_test.go +61 -0
- package/extensions/ahp/internal/testkit/schema/LICENSE-agent-host-protocol +21 -0
- package/extensions/ahp/internal/testkit/schema/actions.schema.json +9208 -0
- package/extensions/ahp/internal/testkit/schema/commands.schema.json +10862 -0
- package/extensions/ahp/internal/testkit/schema/errors.schema.json +10928 -0
- package/extensions/ahp/internal/testkit/schema/notifications.schema.json +6667 -0
- package/extensions/ahp/internal/testkit/schema/state.schema.json +6392 -0
- package/extensions/ahp/internal/testkit/schema.go +360 -0
- package/extensions/ahp/internal/testkit/testkit.go +367 -0
- package/extensions/ahp/internal/twin/twin.go +27 -0
- package/extensions/ahp/internal/wire/dispatchable.go +106 -0
- package/extensions/ahp/internal/wire/dispatchable_list.go +15 -0
- package/extensions/ahp/internal/wire/helpers_test.go +5 -0
- package/extensions/ahp/internal/wire/wire.go +218 -0
- package/extensions/ahp/internal/wire/wire_test.go +123 -0
- package/extensions/ahp/internal/ws/helpers_test.go +7 -0
- package/extensions/ahp/internal/ws/vscode_test.go +198 -0
- package/extensions/ahp/internal/ws/ws.go +674 -0
- package/extensions/ahp/internal/ws/ws_test.go +324 -0
- package/extensions/ahp/realpig_test.go +589 -0
- package/extensions/ahp/runtime.go +311 -0
- package/extensions/ahp/runtime_test.go +110 -0
- package/extensions/ahp/testdata/upstream-tests.json +3833 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/LICENSE +21 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/NOTICE-PIGPEN.md +18 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/ahp/client.go +1011 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/ahp/error.go +111 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/ahp/multi_host_state_mirror.go +239 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/ahp/reducers.go +1939 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/ahp/transport.go +176 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/ahptypes/actions.generated.go +2447 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/ahptypes/commands.generated.go +1546 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/ahptypes/common.go +205 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/ahptypes/errors.generated.go +65 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/ahptypes/messages.generated.go +138 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/ahptypes/notifications.generated.go +264 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/ahptypes/state.generated.go +6171 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/ahptypes/version.generated.go +31 -0
- package/extensions/ahp/third_party/agent-host-protocol-go/go.mod +3 -0
- package/extensions/ahp/twins_test.go +91 -0
- package/package.json +40 -0
- package/proof/PORT.md +121 -0
- package/proof/mutations.json +152 -0
- package/proof/oracle/LICENSE +21 -0
- package/proof/oracle/README.md +120 -0
- package/proof/oracle/UPSTREAM.md +7 -0
- package/proof/oracle/package.json +68 -0
- package/proof/oracle/src/bin/cli.ts +66 -0
- package/proof/oracle/src/bin/tunnel.ts +128 -0
- package/proof/oracle/src/channels/chat.ts +134 -0
- package/proof/oracle/src/channels/root.ts +39 -0
- package/proof/oracle/src/channels/session.ts +118 -0
- package/proof/oracle/src/channels/terminal.ts +11 -0
- package/proof/oracle/src/core/channels.ts +108 -0
- package/proof/oracle/src/core/client-workarounds.ts +358 -0
- package/proof/oracle/src/core/connection.ts +41 -0
- package/proof/oracle/src/core/host.ts +882 -0
- package/proof/oracle/src/core/sequencer.ts +75 -0
- package/proof/oracle/src/core/state-store.ts +162 -0
- package/proof/oracle/src/core/uri.ts +25 -0
- package/proof/oracle/src/host/direct-settings.ts +110 -0
- package/proof/oracle/src/host/pi-host.ts +220 -0
- package/proof/oracle/src/host/serve.ts +71 -0
- package/proof/oracle/src/host/terminal-service.ts +346 -0
- package/proof/oracle/src/pi/activity.ts +171 -0
- package/proof/oracle/src/pi/changeset-service.ts +646 -0
- package/proof/oracle/src/pi/changeset-uri.ts +64 -0
- package/proof/oracle/src/pi/chat-driver.ts +529 -0
- package/proof/oracle/src/pi/completions.ts +160 -0
- package/proof/oracle/src/pi/delete-session.ts +53 -0
- package/proof/oracle/src/pi/event-mapper.ts +648 -0
- package/proof/oracle/src/pi/git-changes.ts +605 -0
- package/proof/oracle/src/pi/history.ts +305 -0
- package/proof/oracle/src/pi/image-input.ts +56 -0
- package/proof/oracle/src/pi/image-mime.ts +8 -0
- package/proof/oracle/src/pi/in-process-backend.ts +155 -0
- package/proof/oracle/src/pi/message-input.ts +212 -0
- package/proof/oracle/src/pi/models.ts +124 -0
- package/proof/oracle/src/pi/project-trust.ts +66 -0
- package/proof/oracle/src/pi/provider.ts +2 -0
- package/proof/oracle/src/pi/resource-paths.ts +80 -0
- package/proof/oracle/src/pi/resource-service.ts +356 -0
- package/proof/oracle/src/pi/resource-watch-policy.ts +35 -0
- package/proof/oracle/src/pi/resource-watch.ts +357 -0
- package/proof/oracle/src/pi/session-catalogue.ts +318 -0
- package/proof/oracle/src/pi/session-config.ts +84 -0
- package/proof/oracle/src/pi/session-history.ts +75 -0
- package/proof/oracle/src/pi/session-hydrator.ts +219 -0
- package/proof/oracle/src/pi/session-registry.ts +815 -0
- package/proof/oracle/src/pi/session-storage.ts +29 -0
- package/proof/oracle/src/pi/session-title.ts +18 -0
- package/proof/oracle/src/pi/turn-paging.ts +94 -0
- package/proof/oracle/src/pi/user-message.ts +66 -0
- package/proof/oracle/src/protocol/errors.ts +44 -0
- package/proof/oracle/src/protocol/jsonrpc.ts +89 -0
- package/proof/oracle/src/protocol/version.ts +39 -0
- package/proof/oracle/src/transport/websocket.ts +136 -0
- package/proof/oracle/src/tunnel/devtunnel.ts +293 -0
- package/proof/oracle/src/tunnel/discovery.ts +37 -0
- package/proof/oracle/test/active-turn-reconnect.test.ts +274 -0
- package/proof/oracle/test/activity.test.ts +171 -0
- package/proof/oracle/test/changeset-lifecycle.test.serial.ts +303 -0
- package/proof/oracle/test/changeset-uri.test.ts +37 -0
- package/proof/oracle/test/changeset.test.serial.ts +487 -0
- package/proof/oracle/test/chat-driver.test.ts +691 -0
- package/proof/oracle/test/client-actions.test.ts +409 -0
- package/proof/oracle/test/client-workarounds.test.ts +320 -0
- package/proof/oracle/test/completions.test.ts +323 -0
- package/proof/oracle/test/delete-session.test.ts +142 -0
- package/proof/oracle/test/direct-settings.test.ts +81 -0
- package/proof/oracle/test/event-mapper.test.ts +619 -0
- package/proof/oracle/test/fetch-turns.test.ts +207 -0
- package/proof/oracle/test/fixtures/abort.json +711 -0
- package/proof/oracle/test/fixtures/bash-long-output.json +1312 -0
- package/proof/oracle/test/fixtures/compaction.json +6285 -0
- package/proof/oracle/test/fixtures/parallel-tools.json +2622 -0
- package/proof/oracle/test/fixtures/plain-text.json +1856 -0
- package/proof/oracle/test/fixtures/single-tool.json +1128 -0
- package/proof/oracle/test/fixtures/steering.json +3926 -0
- package/proof/oracle/test/fixtures/tool-bash.json +2372 -0
- package/proof/oracle/test/fixtures/tool-edit.json +3983 -0
- package/proof/oracle/test/fixtures/tool-error.json +2850 -0
- package/proof/oracle/test/fixtures/tool-find.json +1162 -0
- package/proof/oracle/test/fixtures/tool-grep.json +2783 -0
- package/proof/oracle/test/fixtures/tool-loop.json +1693 -0
- package/proof/oracle/test/fixtures/tool-ls.json +2427 -0
- package/proof/oracle/test/fixtures/tool-write.json +1271 -0
- package/proof/oracle/test/handshake.test.ts +275 -0
- package/proof/oracle/test/harness.ts +153 -0
- package/proof/oracle/test/hydrated-session-lifecycle.test.ts +211 -0
- package/proof/oracle/test/image-input.test.ts +28 -0
- package/proof/oracle/test/image-session.test.ts +69 -0
- package/proof/oracle/test/live-turn.test.ts +304 -0
- package/proof/oracle/test/mapper-fixtures.test.ts +293 -0
- package/proof/oracle/test/message-input.test.ts +181 -0
- package/proof/oracle/test/model-discovery.test.ts +170 -0
- package/proof/oracle/test/models.test.ts +109 -0
- package/proof/oracle/test/pi-host.test.ts +91 -0
- package/proof/oracle/test/pi-replay.test.ts +141 -0
- package/proof/oracle/test/project-trust.test.ts +125 -0
- package/proof/oracle/test/protocol-surface.test.ts +121 -0
- package/proof/oracle/test/pty.test.ts +100 -0
- package/proof/oracle/test/reconnect.test.ts +389 -0
- package/proof/oracle/test/resource-watch-policy.test.ts +78 -0
- package/proof/oracle/test/resource-watch.test.serial.ts +536 -0
- package/proof/oracle/test/resource.test.ts +499 -0
- package/proof/oracle/test/schema.test.ts +88 -0
- package/proof/oracle/test/session-catalogue.test.ts +314 -0
- package/proof/oracle/test/session-config.test.ts +224 -0
- package/proof/oracle/test/session-disposal.test.ts +364 -0
- package/proof/oracle/test/session-hydration.test.ts +194 -0
- package/proof/oracle/test/session-lifecycle.test.ts +416 -0
- package/proof/oracle/test/session-storage.test.serial.ts +32 -0
- package/proof/oracle/test/session-summary.test.ts +418 -0
- package/proof/oracle/test/subscriptions.test.ts +198 -0
- package/proof/oracle/test/support/assertions.ts +32 -0
- package/proof/oracle/test/support/async.ts +26 -0
- package/proof/oracle/test/support/hydrated-session.ts +205 -0
- package/proof/oracle/test/support/images.ts +8 -0
- package/proof/oracle/test/support/recorded-fixtures.ts +60 -0
- package/proof/oracle/test/support/recorded-scenarios.ts +145 -0
- package/proof/oracle/test/support/replay.ts +194 -0
- package/proof/oracle/test/support/schema.ts +221 -0
- package/proof/oracle/test/support/session-files.ts +12 -0
- package/proof/oracle/test/support/session-storage.ts +22 -0
- package/proof/oracle/test/support/upstream.ts +25 -0
- package/proof/oracle/test/support/watch-events.ts +108 -0
- package/proof/oracle/test/terminal-service.test.ts +495 -0
- package/proof/oracle/test/truncate.test.ts +230 -0
- package/proof/oracle/test/tunnel.test.ts +258 -0
- package/proof/oracle/test/upstream-workarounds.test.ts +37 -0
- package/proof/oracle/test/uri.test.ts +24 -0
- package/proof/oracle/test/watch-events.test.ts +118 -0
- package/proof/oracle/tsconfig.json +32 -0
- package/proof/proof-piglet/piglet.yaml +18 -0
- package/proof/tools/fakellm/go.mod +3 -0
- package/proof/tools/fakellm/main.go +109 -0
- package/proof/tools/gen-dispatchable.py +30 -0
- package/provenance.json +28 -0
|
@@ -0,0 +1,1546 @@
|
|
|
1
|
+
// Generated from types/*.ts — do not edit.
|
|
2
|
+
//
|
|
3
|
+
// Regenerate with: npm run generate:go
|
|
4
|
+
|
|
5
|
+
package ahptypes
|
|
6
|
+
|
|
7
|
+
import (
|
|
8
|
+
"encoding/json"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
// Reference the encoding/json import to keep gofmt -d from
|
|
12
|
+
// stripping it when a generated file has no struct that mentions
|
|
13
|
+
// json.RawMessage directly (rare but possible). Compiled out.
|
|
14
|
+
var _ = json.RawMessage(nil)
|
|
15
|
+
|
|
16
|
+
// ─── Enums ────────────────────────────────────────────────────────────
|
|
17
|
+
|
|
18
|
+
// Discriminant for reconnect result types.
|
|
19
|
+
type ReconnectResultType string
|
|
20
|
+
|
|
21
|
+
const (
|
|
22
|
+
ReconnectResultTypeReplay ReconnectResultType = "replay"
|
|
23
|
+
ReconnectResultTypeSnapshot ReconnectResultType = "snapshot"
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
// How a new chat uses its source chat and turn.
|
|
27
|
+
type ChatSourceKind string
|
|
28
|
+
|
|
29
|
+
const (
|
|
30
|
+
// Copy source history through the referenced turn into the new chat.
|
|
31
|
+
ChatSourceKindFork ChatSourceKind = "fork"
|
|
32
|
+
// Supply source context without copying it into the new chat's visible history.
|
|
33
|
+
ChatSourceKindSideChat ChatSourceKind = "sideChat"
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
// Encoding of fetched content data.
|
|
37
|
+
type ContentEncoding string
|
|
38
|
+
|
|
39
|
+
const (
|
|
40
|
+
ContentEncodingBase64 ContentEncoding = "base64"
|
|
41
|
+
ContentEncodingUtf8 ContentEncoding = "utf-8"
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
// The kind of completion items being requested.
|
|
45
|
+
type CompletionItemKind string
|
|
46
|
+
|
|
47
|
+
const (
|
|
48
|
+
// Completions for the text of a {@link Message} the user is composing.
|
|
49
|
+
// Each returned item carries an attachment that gets associated with the
|
|
50
|
+
// message when accepted.
|
|
51
|
+
CompletionItemKindUserMessage CompletionItemKind = "userMessage"
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
// Discriminant for {@link ResourceResolveResult.type}.
|
|
55
|
+
type ResourceType string
|
|
56
|
+
|
|
57
|
+
const (
|
|
58
|
+
ResourceTypeFile ResourceType = "file"
|
|
59
|
+
ResourceTypeDirectory ResourceType = "directory"
|
|
60
|
+
ResourceTypeSymlink ResourceType = "symlink"
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
// How {@link ResourceWriteParams.data} is placed within the target file.
|
|
64
|
+
//
|
|
65
|
+
// Each mode interprets {@link ResourceWriteParams.position} differently:
|
|
66
|
+
//
|
|
67
|
+
// - `truncate` (default): rooted at the **start** of the file. The file is
|
|
68
|
+
// truncated at `position` (0 by default) and `data` is written from that
|
|
69
|
+
// offset, so the resulting file is `existing[0..position] + data`. With
|
|
70
|
+
// `position` omitted this is a full overwrite.
|
|
71
|
+
// - `append`: rooted at the **end** of the file. `position` counts bytes
|
|
72
|
+
// backwards from EOF, so `position: 0` (the default) writes at EOF —
|
|
73
|
+
// POSIX append — and `position: 5` inserts `data` 5 bytes before the
|
|
74
|
+
// current EOF, shifting those trailing 5 bytes after the inserted region.
|
|
75
|
+
// The server MUST evaluate the effective EOF and write atomically with
|
|
76
|
+
// respect to other appenders so concurrent `append` writes do not
|
|
77
|
+
// clobber each other.
|
|
78
|
+
// - `insert`: rooted at the **start** of the file. `position` (0 by default)
|
|
79
|
+
// is the byte offset at which `data` is spliced in; bytes at or after
|
|
80
|
+
// `position` are shifted right by `data.length`. `insert` always grows
|
|
81
|
+
// the file — use `truncate` to overwrite bytes in place.
|
|
82
|
+
type ResourceWriteMode string
|
|
83
|
+
|
|
84
|
+
const (
|
|
85
|
+
ResourceWriteModeTruncate ResourceWriteMode = "truncate"
|
|
86
|
+
ResourceWriteModeAppend ResourceWriteMode = "append"
|
|
87
|
+
ResourceWriteModeInsert ResourceWriteMode = "insert"
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
// ─── Command Payloads ─────────────────────────────────────────────────
|
|
91
|
+
|
|
92
|
+
// Establishes a new connection and negotiates the protocol version.
|
|
93
|
+
// This MUST be the first message sent by the client.
|
|
94
|
+
type InitializeParams struct {
|
|
95
|
+
// Channel URI this command targets.
|
|
96
|
+
Channel URI `json:"channel"`
|
|
97
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
98
|
+
// Receivers MUST ignore keys they do not understand.
|
|
99
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
100
|
+
// Protocol versions the client is willing to speak, ordered from most
|
|
101
|
+
// preferred to least preferred. Each entry is a [SemVer](https://semver.org)
|
|
102
|
+
// `MAJOR.MINOR.PATCH` string (e.g. `"0.1.0"`).
|
|
103
|
+
//
|
|
104
|
+
// The server selects one entry and returns it as `InitializeResult.protocolVersion`.
|
|
105
|
+
// If the server cannot speak any of the offered versions, it MUST return
|
|
106
|
+
// error code `-32005` (`UnsupportedProtocolVersion`) with required
|
|
107
|
+
// `UnsupportedProtocolVersionErrorData` containing `supportedVersions`.
|
|
108
|
+
ProtocolVersions []string `json:"protocolVersions"`
|
|
109
|
+
// Unique client identifier
|
|
110
|
+
ClientId string `json:"clientId"`
|
|
111
|
+
// Optional identity of the client implementation (name and version).
|
|
112
|
+
// Informational only — see {@link Implementation} for how it may and may not
|
|
113
|
+
// be used. Distinct from {@link InitializeParams.clientId | `clientId`},
|
|
114
|
+
// which is an opaque per-connection identifier used for reconnection, not a
|
|
115
|
+
// human-readable implementation name.
|
|
116
|
+
ClientInfo *Implementation `json:"clientInfo,omitempty"`
|
|
117
|
+
// URIs to subscribe to during handshake
|
|
118
|
+
InitialSubscriptions []URI `json:"initialSubscriptions,omitempty"`
|
|
119
|
+
// IETF BCP 47 language tag indicating the client's preferred locale
|
|
120
|
+
// (e.g. `"en-US"`, `"ja"`). The server SHOULD use this to localise
|
|
121
|
+
// user-facing strings such as confirmation option labels.
|
|
122
|
+
Locale *string `json:"locale,omitempty"`
|
|
123
|
+
// Optional client capability declarations.
|
|
124
|
+
//
|
|
125
|
+
// Servers SHOULD only advertise features whose corresponding client
|
|
126
|
+
// capability is set here. Absent means "not declared" — the server
|
|
127
|
+
// MUST assume the client does not support the feature.
|
|
128
|
+
Capabilities *ClientCapabilities `json:"capabilities,omitempty"`
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Result of the `initialize` command.
|
|
132
|
+
//
|
|
133
|
+
// `protocolVersion` is the version the server has selected from the client's
|
|
134
|
+
// `protocolVersions` list. The client and server MUST use this version for
|
|
135
|
+
// the rest of the connection. If the server cannot speak any of the offered
|
|
136
|
+
// versions it MUST return error code `-32005` (`UnsupportedProtocolVersion`)
|
|
137
|
+
// with required `UnsupportedProtocolVersionErrorData` containing
|
|
138
|
+
// `supportedVersions`, instead of a result.
|
|
139
|
+
type InitializeResult struct {
|
|
140
|
+
// Protocol version selected by the server. MUST be one of the entries in
|
|
141
|
+
// `InitializeParams.protocolVersions`. Formatted as a [SemVer](https://semver.org)
|
|
142
|
+
// `MAJOR.MINOR.PATCH` string (e.g. `"0.1.0"`).
|
|
143
|
+
ProtocolVersion string `json:"protocolVersion"`
|
|
144
|
+
// Current server sequence number
|
|
145
|
+
ServerSeq int64 `json:"serverSeq"`
|
|
146
|
+
// Optional identity of the server implementation (name and version).
|
|
147
|
+
// Informational only — see {@link Implementation} for how it may and may not
|
|
148
|
+
// be used. Whereas {@link InitializeResult.protocolVersion | `protocolVersion`}
|
|
149
|
+
// identifies the negotiated protocol, `serverInfo` identifies the host
|
|
150
|
+
// software behind it.
|
|
151
|
+
ServerInfo *Implementation `json:"serverInfo,omitempty"`
|
|
152
|
+
// Optional implementation-specific extension metadata advertised by the host.
|
|
153
|
+
//
|
|
154
|
+
// Hosts and clients MAY agree on namespaced keys for capabilities that are not
|
|
155
|
+
// part of the standardized protocol. Clients MUST ignore keys they do not
|
|
156
|
+
// understand. Capabilities needed for interoperable behavior SHOULD use typed
|
|
157
|
+
// fields on {@link InitializeResult} instead.
|
|
158
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
159
|
+
// Snapshots for each `initialSubscriptions` URI
|
|
160
|
+
Snapshots []Snapshot `json:"snapshots"`
|
|
161
|
+
// Suggested default directory for remote filesystem browsing
|
|
162
|
+
DefaultDirectory *URI `json:"defaultDirectory,omitempty"`
|
|
163
|
+
// Characters that, when typed in a {@link Message} input, SHOULD cause
|
|
164
|
+
// the client to issue a `completions` request with
|
|
165
|
+
// {@link CompletionItemKind.UserMessage}. Typically includes characters like
|
|
166
|
+
// `'@'` or `'/'`.
|
|
167
|
+
CompletionTriggerCharacters []string `json:"completionTriggerCharacters,omitempty"`
|
|
168
|
+
// Prefix that the host recognizes at the start of a user {@link Message.text}
|
|
169
|
+
// as a shorthand for executing the remainder as a terminal command. Currently
|
|
170
|
+
// the standardized convention is `"!"`; absence means the host does not
|
|
171
|
+
// support command prefixes.
|
|
172
|
+
TerminalCommandPrefix *string `json:"terminalCommandPrefix,omitempty"`
|
|
173
|
+
// OTLP telemetry channels the host emits, if any. Each populated field is
|
|
174
|
+
// either a literal `ahp-otlp:` channel URI or an RFC 6570 URI template a
|
|
175
|
+
// client expands before subscribing (currently only the `logs` channel
|
|
176
|
+
// defines a template variable, `{level}`, for subscriber-side severity
|
|
177
|
+
// filtering). Clients MAY ignore signals they cannot process.
|
|
178
|
+
Telemetry *TelemetryCapabilities `json:"telemetry,omitempty"`
|
|
179
|
+
// Host-owned automation support. Presence means clients may subscribe to
|
|
180
|
+
// `ahp-automations://` for {@link AutomationState}; absence means the
|
|
181
|
+
// host does not expose an automation catalogue or automation commands.
|
|
182
|
+
Automations *AutomationCapabilities `json:"automations,omitempty"`
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Optional capabilities a client declares during `initialize`.
|
|
186
|
+
//
|
|
187
|
+
// Each field is a presence flag: an empty object `{}` means "supported",
|
|
188
|
+
// absence means "not supported". Sub-fields on individual capabilities
|
|
189
|
+
// are reserved for future per-capability options.
|
|
190
|
+
type ClientCapabilities struct {
|
|
191
|
+
// Client can render
|
|
192
|
+
// [MCP Apps](https://github.com/modelcontextprotocol/ext-apps) — i.e.
|
|
193
|
+
// it can host the View sandbox, run the `ui/*` protocol against it,
|
|
194
|
+
// and forward `mcp://`-channel traffic on the App's behalf.
|
|
195
|
+
//
|
|
196
|
+
// Hosts SHOULD only populate
|
|
197
|
+
// {@link McpServerCustomization.mcpApp | `McpServerCustomization.mcpApp`}
|
|
198
|
+
// (and expose the corresponding
|
|
199
|
+
// {@link McpServerCustomization.channel | `mcp://` channel}) when this
|
|
200
|
+
// capability is declared. Clients that omit it MUST treat
|
|
201
|
+
// App-bearing tool calls as ordinary MCP tool calls.
|
|
202
|
+
McpApps map[string]json.RawMessage `json:"mcpApps,omitempty"`
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Automation features supported by this host authority.
|
|
206
|
+
//
|
|
207
|
+
// The presence of this object advertises the baseline `ahp-automations://`
|
|
208
|
+
// catalogue. Optional fields describe additional host features and
|
|
209
|
+
// restrictions.
|
|
210
|
+
//
|
|
211
|
+
// Capabilities describe implementation support.
|
|
212
|
+
// {@link AutomationEntry.operations} remains authoritative for which
|
|
213
|
+
// definition mutations are currently allowed on a particular automation.
|
|
214
|
+
type AutomationCapabilities struct {
|
|
215
|
+
// Present when clients may dispatch {@link AutomationCreateRequestedAction}.
|
|
216
|
+
Create *AutomationCreateCapability `json:"create,omitempty"`
|
|
217
|
+
// Present when definitions may contain {@link AutomationScheduleTrigger | schedule triggers}.
|
|
218
|
+
Schedules *AutomationScheduleCapabilities `json:"schedules,omitempty"`
|
|
219
|
+
// Present when clients may request cancellation of `pending` or `running`
|
|
220
|
+
// automation runs.
|
|
221
|
+
RunCancellation *AutomationRunCancellationCapability `json:"runCancellation,omitempty"`
|
|
222
|
+
// Maximum terminal entries retained in {@link AutomationEntry.runs}. Active
|
|
223
|
+
// runs are not counted toward the limit. Absence means the retention limit is
|
|
224
|
+
// implementation-defined.
|
|
225
|
+
RunHistoryLimit *int64 `json:"runHistoryLimit,omitempty"`
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Presence capability for {@link AutomationCreateRequestedAction |
|
|
229
|
+
// `automation/createRequested`}.
|
|
230
|
+
//
|
|
231
|
+
// The empty object means "supported"; fields are reserved for future
|
|
232
|
+
// create-specific options.
|
|
233
|
+
type AutomationCreateCapability struct {
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Host restrictions on portable {@link AutomationSchedule} triggers.
|
|
237
|
+
//
|
|
238
|
+
// The cron grammar itself is fixed by AHP. Hosts MUST accept every expression
|
|
239
|
+
// in that grammar unless it violates an advertised interval restriction.
|
|
240
|
+
type AutomationScheduleCapabilities struct {
|
|
241
|
+
// Smallest permitted interval between consecutive occurrences produced by
|
|
242
|
+
// {@link AutomationSchedule.expression}. Omission means no restriction beyond
|
|
243
|
+
// the cron format's one-minute resolution.
|
|
244
|
+
MinIntervalMinutes *int64 `json:"minIntervalMinutes,omitempty"`
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Presence capability for {@link AutomationRunCancelRequestedAction |
|
|
248
|
+
// `automationRun/cancelRequested`}.
|
|
249
|
+
//
|
|
250
|
+
// The empty object means "supported." Clients may dispatch the action for
|
|
251
|
+
// `pending` or `running` runs; terminal runs cannot be cancelled.
|
|
252
|
+
type AutomationRunCancellationCapability struct {
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Identifies a protocol implementation — the software (and build) on one end
|
|
256
|
+
// of the connection, as distinct from the {@link AgentInfo | agent persona} it
|
|
257
|
+
// hosts. Carried as {@link InitializeParams.clientInfo | `clientInfo`} on the
|
|
258
|
+
// client side and {@link InitializeResult.serverInfo | `serverInfo`} on the
|
|
259
|
+
// server side, mirroring LSP's `clientInfo`/`serverInfo` and MCP's
|
|
260
|
+
// `Implementation`.
|
|
261
|
+
//
|
|
262
|
+
// This is **informational only**: it exists for logging, telemetry, an
|
|
263
|
+
// about/status affordance, and — as a last resort — a known-issue workaround
|
|
264
|
+
// for a specific buggy build. It is **not** a feature-detection mechanism.
|
|
265
|
+
// Feature availability stays with the capability model
|
|
266
|
+
// ({@link ClientCapabilities} and the various `*.capabilities` declarations);
|
|
267
|
+
// implementations SHOULD NOT gate protocol behaviour on parsing
|
|
268
|
+
// {@link Implementation.version | `version`}.
|
|
269
|
+
type Implementation struct {
|
|
270
|
+
// Implementation name, e.g. a product or package identifier.
|
|
271
|
+
Name string `json:"name"`
|
|
272
|
+
// Implementation version. A [SemVer](https://semver.org) string is
|
|
273
|
+
// recommended but not required.
|
|
274
|
+
Version *string `json:"version,omitempty"`
|
|
275
|
+
// Optional human-readable display name.
|
|
276
|
+
Title *string `json:"title,omitempty"`
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Re-establishes a dropped connection. The server replays missed actions or
|
|
280
|
+
// provides fresh snapshots.
|
|
281
|
+
type ReconnectParams struct {
|
|
282
|
+
// Channel URI this command targets.
|
|
283
|
+
Channel URI `json:"channel"`
|
|
284
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
285
|
+
// Receivers MUST ignore keys they do not understand.
|
|
286
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
287
|
+
// Client identifier from the original connection
|
|
288
|
+
ClientId string `json:"clientId"`
|
|
289
|
+
// Last `serverSeq` the client received
|
|
290
|
+
LastSeenServerSeq int64 `json:"lastSeenServerSeq"`
|
|
291
|
+
// URIs the client was subscribed to
|
|
292
|
+
Subscriptions []URI `json:"subscriptions"`
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Reconnect result when the server can replay from the requested sequence.
|
|
296
|
+
//
|
|
297
|
+
// The server MUST include all replayed data in the response.
|
|
298
|
+
type ReconnectReplayResult struct {
|
|
299
|
+
// Missed action envelopes since `lastSeenServerSeq`
|
|
300
|
+
Actions []ActionEnvelope `json:"actions"`
|
|
301
|
+
// URIs from `ReconnectParams.subscriptions` that the server cannot resume.
|
|
302
|
+
// This includes resources that no longer exist (e.g. disposed sessions or
|
|
303
|
+
// terminals) as well as resources the client is no longer permitted to
|
|
304
|
+
// observe. Clients SHOULD drop these from their local subscription set.
|
|
305
|
+
Missing []URI `json:"missing"`
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// Reconnect result when the gap exceeds the replay buffer.
|
|
309
|
+
type ReconnectSnapshotResult struct {
|
|
310
|
+
// Fresh snapshots for each subscription
|
|
311
|
+
Snapshots []Snapshot `json:"snapshots"`
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// Subscribe to a URI-identified channel.
|
|
315
|
+
//
|
|
316
|
+
// A channel MAY have state associated with it (e.g. root, sessions,
|
|
317
|
+
// terminals) or be stateless (pure pub/sub for streaming data). For
|
|
318
|
+
// state-bearing channels the result includes a snapshot; for stateless
|
|
319
|
+
// channels `snapshot` is omitted.
|
|
320
|
+
type SubscribeParams struct {
|
|
321
|
+
// Channel URI this command targets.
|
|
322
|
+
Channel URI `json:"channel"`
|
|
323
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
324
|
+
// Receivers MUST ignore keys they do not understand.
|
|
325
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
326
|
+
// Optional delivery preferences for this subscription.
|
|
327
|
+
//
|
|
328
|
+
// Servers MAY use these preferences to buffer and coalesce high-frequency
|
|
329
|
+
// updates while preserving the same reduced state. Omit this field for the
|
|
330
|
+
// server's default delivery behavior.
|
|
331
|
+
Delivery *SubscriptionDeliveryOptions `json:"delivery,omitempty"`
|
|
332
|
+
// Optional client-requested shape for the returned snapshot.
|
|
333
|
+
//
|
|
334
|
+
// Servers that do not understand a requested view ignore it and return their
|
|
335
|
+
// default snapshot. Clients MUST tolerate receiving more state than requested.
|
|
336
|
+
View *SubscribeView `json:"view,omitempty"`
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Optional client-requested shape for a subscription snapshot.
|
|
340
|
+
type SubscribeView struct {
|
|
341
|
+
// Advisory number of most-recent completed turns to expose in a chat
|
|
342
|
+
// snapshot.
|
|
343
|
+
//
|
|
344
|
+
// Servers MAY return more or fewer turns than requested. When omitted, the
|
|
345
|
+
// host MUST return all retained turns. When older turns remain available, the
|
|
346
|
+
// returned {@link ChatState} carries `turnsNextCursor`; clients pass that
|
|
347
|
+
// cursor to `fetchTurns` to ask the host to page more turns into the chat
|
|
348
|
+
// state.
|
|
349
|
+
Turns *int64 `json:"turns,omitempty"`
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// Advisory delivery preferences for a single subscription.
|
|
353
|
+
type SubscriptionDeliveryOptions struct {
|
|
354
|
+
// Maximum time, in milliseconds, that the server may intentionally delay
|
|
355
|
+
// delivery while buffering/coalescing updates for this subscription.
|
|
356
|
+
//
|
|
357
|
+
// A value of `0` requests immediate delivery with no intentional coalescing.
|
|
358
|
+
MaxLatencyMs *int64 `json:"maxLatencyMs,omitempty"`
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// Result of the `subscribe` command.
|
|
362
|
+
//
|
|
363
|
+
// `snapshot` is present when the subscribed channel has associated state, and
|
|
364
|
+
// absent for stateless channels.
|
|
365
|
+
type SubscribeResult struct {
|
|
366
|
+
// Snapshot of the subscribed channel's state (omitted for stateless channels)
|
|
367
|
+
Snapshot *Snapshot `json:"snapshot,omitempty"`
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// Creates a new session with the specified agent provider.
|
|
371
|
+
//
|
|
372
|
+
// If the session URI already exists, the server MUST return an error with code
|
|
373
|
+
// `-32003` (`SessionAlreadyExists`).
|
|
374
|
+
//
|
|
375
|
+
// After creation, the client should subscribe to the session URI to receive state
|
|
376
|
+
// updates. The server also broadcasts a `root/sessionAdded` notification to all
|
|
377
|
+
// clients.
|
|
378
|
+
type CreateSessionParams struct {
|
|
379
|
+
// Channel URI this command targets.
|
|
380
|
+
Channel URI `json:"channel"`
|
|
381
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
382
|
+
// Receivers MUST ignore keys they do not understand.
|
|
383
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
384
|
+
// Agent provider ID
|
|
385
|
+
Provider *string `json:"provider,omitempty"`
|
|
386
|
+
// The working directories the session's agent is granted tool access to.
|
|
387
|
+
// A session may span multiple directories; they are equal peers except when
|
|
388
|
+
// the agent advertises a protected-primary capability. An
|
|
389
|
+
// {@link MultipleWorkingDirectoriesCapability.immutablePrimary | immutable
|
|
390
|
+
// primary} is fixed, while a
|
|
391
|
+
// {@link MultipleWorkingDirectoriesCapability.primaryReplacement | replaceable
|
|
392
|
+
// primary} is changed only with `session/workingDirectoryReplaced`.
|
|
393
|
+
//
|
|
394
|
+
// A client MUST NOT supply more than one entry unless the agent advertises
|
|
395
|
+
// {@link AgentCapabilities.multipleWorkingDirectories}; a server without that
|
|
396
|
+
// capability treats only the first entry as the session's working directory
|
|
397
|
+
// and ignores the rest. Dispatch working-directory actions to change the set
|
|
398
|
+
// after the session has started.
|
|
399
|
+
WorkingDirectories []URI `json:"workingDirectories,omitempty"`
|
|
400
|
+
// Agent-specific configuration values collected via `resolveSessionConfig`.
|
|
401
|
+
// Keys and values correspond to the schema returned by the server.
|
|
402
|
+
Config map[string]json.RawMessage `json:"config,omitempty"`
|
|
403
|
+
// Eagerly claim an active client role for the new session.
|
|
404
|
+
//
|
|
405
|
+
// When provided, the server initializes the session with this client as an
|
|
406
|
+
// active client, equivalent to dispatching a `session/activeClientSet`
|
|
407
|
+
// action immediately after creation. The `clientId` MUST match the
|
|
408
|
+
// `clientId` the creating client supplied in `initialize`.
|
|
409
|
+
ActiveClient *SessionActiveClient `json:"activeClient,omitempty"`
|
|
410
|
+
// Opt-in progress token. When set, the client is offering to receive
|
|
411
|
+
// `progress` notifications (see `ProgressParams`) for any long-running work
|
|
412
|
+
// the server does to bring this session up — most notably the lazy,
|
|
413
|
+
// first-use download of the provider's native SDK. The server echoes this
|
|
414
|
+
// exact token on every `progress` frame so the client can correlate it to
|
|
415
|
+
// this `createSession` call (and the UI awaiting it).
|
|
416
|
+
//
|
|
417
|
+
// The token MUST be unique across the client's active requests. The server
|
|
418
|
+
// MAY ignore it (e.g. when nothing long-running is needed), in which case no
|
|
419
|
+
// `progress` notifications are emitted.
|
|
420
|
+
ProgressToken *string `json:"progressToken,omitempty"`
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// Disposes a session and cleans up server-side resources.
|
|
424
|
+
//
|
|
425
|
+
// The server broadcasts a `root/sessionRemoved` notification to all clients.
|
|
426
|
+
type DisposeSessionParams struct {
|
|
427
|
+
// Channel URI this command targets.
|
|
428
|
+
Channel URI `json:"channel"`
|
|
429
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
430
|
+
// Receivers MUST ignore keys they do not understand.
|
|
431
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// Copies source history through a completed turn into the new chat.
|
|
435
|
+
type ForkChatSource struct {
|
|
436
|
+
// Discriminant
|
|
437
|
+
Kind ChatSourceKind `json:"kind"`
|
|
438
|
+
// URI of the existing source chat.
|
|
439
|
+
Chat URI `json:"chat"`
|
|
440
|
+
// Completed turn identifier in the source chat.
|
|
441
|
+
//
|
|
442
|
+
// Content through this turn is copied into the new chat's visible `turns`.
|
|
443
|
+
TurnId string `json:"turnId"`
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Supplies source context to a new side chat without copying it into the side
|
|
447
|
+
// chat's visible history.
|
|
448
|
+
type SideChatSource struct {
|
|
449
|
+
// Discriminant
|
|
450
|
+
Kind ChatSourceKind `json:"kind"`
|
|
451
|
+
// URI of the existing source chat.
|
|
452
|
+
Chat URI `json:"chat"`
|
|
453
|
+
// Stable source-turn identifier in the source chat.
|
|
454
|
+
//
|
|
455
|
+
// Hosts resolve this id against the source chat's current `activeTurn` or its
|
|
456
|
+
// retained `turns` when accepting `createChat`. If it names the current
|
|
457
|
+
// active turn, the host snapshots the source chat's retained history plus
|
|
458
|
+
// that turn's current user message and any partial assistant response already
|
|
459
|
+
// available. Once that turn later becomes historical, it is still referenced
|
|
460
|
+
// by this same identifier.
|
|
461
|
+
TurnId string `json:"turnId"`
|
|
462
|
+
// Optional immutable selected-text snapshot to carry into the created side
|
|
463
|
+
// chat's origin.
|
|
464
|
+
//
|
|
465
|
+
// When present, the host MUST snapshot and preserve this exact selection when
|
|
466
|
+
// it accepts `createChat`; later source-turn deltas do not alter it.
|
|
467
|
+
Selection *SideChatSelection `json:"selection,omitempty"`
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// Creates a new chat within a session.
|
|
471
|
+
type CreateChatParams struct {
|
|
472
|
+
// Channel URI this command targets.
|
|
473
|
+
Channel URI `json:"channel"`
|
|
474
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
475
|
+
// Receivers MUST ignore keys they do not understand.
|
|
476
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
477
|
+
// Chat URI (client-chosen, e.g. `ahp-chat:/<uuid>`).
|
|
478
|
+
Chat URI `json:"chat"`
|
|
479
|
+
// Optional initial message for the new chat.
|
|
480
|
+
InitialMessage *Message `json:"initialMessage,omitempty"`
|
|
481
|
+
// Optional source chat and source turn.
|
|
482
|
+
//
|
|
483
|
+
// The source chat MUST belong to this session. Clients MUST only request
|
|
484
|
+
// `kind: "fork"` when the selected agent advertises
|
|
485
|
+
// `capabilities.multipleChats.fork`, and `kind: "sideChat"` when the
|
|
486
|
+
// selected agent advertises `capabilities.multipleChats.sideChat`. Both
|
|
487
|
+
// source forms carry a stable top-level `turnId`. Forks target completed
|
|
488
|
+
// turns. Side chats also carry a stable `turnId`, which the host resolves
|
|
489
|
+
// against the source chat's current active turn or retained history. If it
|
|
490
|
+
// resolves to the active turn, the host snapshots the currently available
|
|
491
|
+
// partial response when accepting `createChat`. When
|
|
492
|
+
// `source.kind === "sideChat"` and `source.selection` is present, the host
|
|
493
|
+
// also snapshots and preserves that exact selected text in the created chat's
|
|
494
|
+
// origin; any `responsePartId` there is provenance only, not a live range.
|
|
495
|
+
Source *ChatSource `json:"source,omitempty"`
|
|
496
|
+
// Initial working-directory subset for this chat. Every entry MUST be
|
|
497
|
+
// present in the owning session's `workingDirectories`; the server MUST
|
|
498
|
+
// reject any entry that is not. When absent, the chat inherits the full
|
|
499
|
+
// session set. Forked chats (those whose `source.kind` is `"fork"`) inherit
|
|
500
|
+
// the source chat's `workingDirectories`; this field is ignored for forks.
|
|
501
|
+
//
|
|
502
|
+
// A client MUST NOT supply this field unless the agent advertises
|
|
503
|
+
// {@link AgentCapabilities.multipleWorkingDirectories}.
|
|
504
|
+
WorkingDirectories []URI `json:"workingDirectories,omitempty"`
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// Disposes a chat and cleans up server-side resources.
|
|
508
|
+
type DisposeChatParams struct {
|
|
509
|
+
// Channel URI this command targets.
|
|
510
|
+
Channel URI `json:"channel"`
|
|
511
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
512
|
+
// Receivers MUST ignore keys they do not understand.
|
|
513
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// Returns a list of session summaries. Used to populate session lists and sidebars.
|
|
517
|
+
//
|
|
518
|
+
// The session list is **not** part of the state tree because it can be arbitrarily
|
|
519
|
+
// large. Clients fetch it imperatively and maintain a local cache updated by
|
|
520
|
+
// `root/sessionAdded` and `root/sessionRemoved` notifications.
|
|
521
|
+
//
|
|
522
|
+
// A large catalogue can be fetched incrementally via the {@link PaginatedParams}
|
|
523
|
+
// `limit`/`cursor` inputs (see that type for the full pagination contract). The
|
|
524
|
+
// server SHOULD return most-recently-modified entries first, so the first page
|
|
525
|
+
// is the immediately useful one. The `root/session*` notifications keep an
|
|
526
|
+
// already-fetched page live; pagination governs only the initial and backfill
|
|
527
|
+
// fetches.
|
|
528
|
+
type ListSessionsParams struct {
|
|
529
|
+
// Channel URI this command targets.
|
|
530
|
+
Channel URI `json:"channel"`
|
|
531
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
532
|
+
// Receivers MUST ignore keys they do not understand.
|
|
533
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
534
|
+
// Maximum number of entries to return in this page. The server SHOULD respect
|
|
535
|
+
// this bound but MAY return fewer entries and MAY impose its own upper cap.
|
|
536
|
+
// Omit to let the server choose the page size.
|
|
537
|
+
Limit *int64 `json:"limit,omitempty"`
|
|
538
|
+
// Opaque pagination cursor from a previous {@link PaginatedResult.nextCursor}.
|
|
539
|
+
// Omit to fetch the first page. Cursors are server-defined and MUST be treated
|
|
540
|
+
// as opaque — do not parse, modify, or persist them across connections. An
|
|
541
|
+
// unrecognised cursor SHOULD be rejected with an `InvalidParams` error.
|
|
542
|
+
Cursor *string `json:"cursor,omitempty"`
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// Result of the `listSessions` command.
|
|
546
|
+
type ListSessionsResult struct {
|
|
547
|
+
// Opaque cursor for the next page. Present when more entries exist beyond the
|
|
548
|
+
// returned page; absent signals the end of the collection. Pass it back as
|
|
549
|
+
// {@link PaginatedParams.cursor} to fetch the following page.
|
|
550
|
+
NextCursor *string `json:"nextCursor,omitempty"`
|
|
551
|
+
// The list of session summaries. The server SHOULD order them
|
|
552
|
+
// most-recently-modified first.
|
|
553
|
+
Items []SessionSummary `json:"items"`
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// Reads the content of a resource by URI.
|
|
557
|
+
//
|
|
558
|
+
// Content references keep the state tree small by storing large data (images,
|
|
559
|
+
// long tool outputs) by reference rather than inline.
|
|
560
|
+
//
|
|
561
|
+
// Binary content (images, etc.) MUST use `base64` encoding. Text content MAY
|
|
562
|
+
// use `utf-8` encoding.
|
|
563
|
+
//
|
|
564
|
+
// Like all `resource*` methods, `resourceRead` is symmetrical and MAY be
|
|
565
|
+
// sent in either direction. Hosts use it to fetch content from a
|
|
566
|
+
// client-published URI (e.g. `virtual://my-client/...` plugins); clients
|
|
567
|
+
// use it to read host-side files. The receiver enforces access via the
|
|
568
|
+
// same permission/`resourceRequest` flow regardless of which peer initiated.
|
|
569
|
+
type ResourceReadParams struct {
|
|
570
|
+
// Channel URI this command targets.
|
|
571
|
+
Channel URI `json:"channel"`
|
|
572
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
573
|
+
// Receivers MUST ignore keys they do not understand.
|
|
574
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
575
|
+
// Content URI from a `ContentRef`
|
|
576
|
+
Uri string `json:"uri"`
|
|
577
|
+
// Preferred encoding for the returned data (default: server-chosen)
|
|
578
|
+
Encoding *ContentEncoding `json:"encoding,omitempty"`
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// Result of the `resourceRead` command.
|
|
582
|
+
//
|
|
583
|
+
// The server SHOULD honor the `encoding` requested in the params. If the
|
|
584
|
+
// server cannot provide the requested encoding, it MUST fall back to either
|
|
585
|
+
// `base64` or `utf-8`.
|
|
586
|
+
type ResourceReadResult struct {
|
|
587
|
+
// Content encoded as a string
|
|
588
|
+
Data string `json:"data"`
|
|
589
|
+
// How `data` is encoded
|
|
590
|
+
Encoding ContentEncoding `json:"encoding"`
|
|
591
|
+
// Content type (e.g. `"image/png"`, `"text/plain"`)
|
|
592
|
+
ContentType *string `json:"contentType,omitempty"`
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// Writes content to a file on the server's filesystem.
|
|
596
|
+
//
|
|
597
|
+
// Binary content (images, etc.) MUST use `base64` encoding. Text content MAY
|
|
598
|
+
// use `utf-8` encoding.
|
|
599
|
+
//
|
|
600
|
+
// If the file does not exist, it is created. If the file already exists, the
|
|
601
|
+
// effect on existing bytes depends on {@link ResourceWriteParams.mode}:
|
|
602
|
+
// `truncate` (default) overwrites from the chosen offset onward, `append`
|
|
603
|
+
// preserves all existing bytes and adds `data` at a position rooted at EOF,
|
|
604
|
+
// and `insert` preserves all existing bytes and splices `data` in at an
|
|
605
|
+
// offset rooted at the start of the file.
|
|
606
|
+
//
|
|
607
|
+
// Like all `resource*` methods, `resourceWrite` is symmetrical and MAY be
|
|
608
|
+
// sent in either direction.
|
|
609
|
+
type ResourceWriteParams struct {
|
|
610
|
+
// Channel URI this command targets.
|
|
611
|
+
Channel URI `json:"channel"`
|
|
612
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
613
|
+
// Receivers MUST ignore keys they do not understand.
|
|
614
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
615
|
+
// Target file URI on the server filesystem
|
|
616
|
+
Uri URI `json:"uri"`
|
|
617
|
+
// Content encoded as a string
|
|
618
|
+
Data string `json:"data"`
|
|
619
|
+
// How `data` is encoded
|
|
620
|
+
Encoding ContentEncoding `json:"encoding"`
|
|
621
|
+
// Content type (e.g. `"text/plain"`, `"image/png"`)
|
|
622
|
+
ContentType *string `json:"contentType,omitempty"`
|
|
623
|
+
// If `true`, the server MUST fail if the file already exists instead of
|
|
624
|
+
// overwriting it. Useful for safe creation of new files.
|
|
625
|
+
CreateOnly *bool `json:"createOnly,omitempty"`
|
|
626
|
+
// How `data` is placed within the target file. Defaults to `'truncate'`
|
|
627
|
+
// (full overwrite) when omitted. See {@link ResourceWriteMode} for the
|
|
628
|
+
// meaning of each mode and how it interprets {@link position}.
|
|
629
|
+
Mode *ResourceWriteMode `json:"mode,omitempty"`
|
|
630
|
+
// Byte offset interpreted according to {@link mode}. Defaults to `0`.
|
|
631
|
+
// - `truncate`: offset from the start of the file at which to truncate
|
|
632
|
+
// before writing.
|
|
633
|
+
// - `append`: bytes back from EOF at which to insert `data`.
|
|
634
|
+
// - `insert`: offset from the start of the file at which to splice in
|
|
635
|
+
// `data`.
|
|
636
|
+
Position *int64 `json:"position,omitempty"`
|
|
637
|
+
// Optimistic-concurrency token previously returned by
|
|
638
|
+
// {@link ResourceResolveResult.etag}. When set, the server MUST fail with
|
|
639
|
+
// `Conflict` if the current `etag` does not match — preventing lost
|
|
640
|
+
// updates between a `resourceResolve` and a subsequent `resourceWrite`.
|
|
641
|
+
IfMatch *string `json:"ifMatch,omitempty"`
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// Result of the `resourceWrite` command.
|
|
645
|
+
//
|
|
646
|
+
// An empty object on success.
|
|
647
|
+
type ResourceWriteResult struct {
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// Lists directory entries at a file URI on the server's filesystem.
|
|
651
|
+
//
|
|
652
|
+
// This is intended for remote folder pickers and similar UI that needs to let
|
|
653
|
+
// users navigate the server's local filesystem.
|
|
654
|
+
//
|
|
655
|
+
// The server MUST return success only if the target exists and is a directory.
|
|
656
|
+
// If the target does not exist, is not a directory, or cannot be accessed, the
|
|
657
|
+
// server MUST return a JSON-RPC error.
|
|
658
|
+
//
|
|
659
|
+
// Like all `resource*` methods, `resourceList` is symmetrical and MAY be
|
|
660
|
+
// sent in either direction.
|
|
661
|
+
type ResourceListParams struct {
|
|
662
|
+
// Channel URI this command targets.
|
|
663
|
+
Channel URI `json:"channel"`
|
|
664
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
665
|
+
// Receivers MUST ignore keys they do not understand.
|
|
666
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
667
|
+
// Directory URI on the server filesystem
|
|
668
|
+
Uri URI `json:"uri"`
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
// Result of the `resourceList` command.
|
|
672
|
+
type ResourceListResult struct {
|
|
673
|
+
// Entries directly contained in the requested directory
|
|
674
|
+
Entries []DirectoryEntry `json:"entries"`
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// Directory entry returned by `resourceList`.
|
|
678
|
+
type DirectoryEntry struct {
|
|
679
|
+
// Base name of the entry
|
|
680
|
+
Name string `json:"name"`
|
|
681
|
+
// Whether the entry is a file or directory
|
|
682
|
+
Type string `json:"type"`
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
// Copies a resource from one URI to another on the server's filesystem.
|
|
686
|
+
//
|
|
687
|
+
// If the destination already exists, it is overwritten unless `failIfExists`
|
|
688
|
+
// is set.
|
|
689
|
+
//
|
|
690
|
+
// Like all `resource*` methods, `resourceCopy` is symmetrical and MAY be
|
|
691
|
+
// sent in either direction.
|
|
692
|
+
type ResourceCopyParams struct {
|
|
693
|
+
// Channel URI this command targets.
|
|
694
|
+
Channel URI `json:"channel"`
|
|
695
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
696
|
+
// Receivers MUST ignore keys they do not understand.
|
|
697
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
698
|
+
// Source URI to copy from
|
|
699
|
+
Source URI `json:"source"`
|
|
700
|
+
// Destination URI to copy to
|
|
701
|
+
Destination URI `json:"destination"`
|
|
702
|
+
// If `true`, the server MUST fail if the destination already exists instead
|
|
703
|
+
// of overwriting it.
|
|
704
|
+
FailIfExists *bool `json:"failIfExists,omitempty"`
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
// Result of the `resourceCopy` command.
|
|
708
|
+
//
|
|
709
|
+
// An empty object on success.
|
|
710
|
+
type ResourceCopyResult struct {
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
// Deletes a resource at a URI on the server's filesystem.
|
|
714
|
+
//
|
|
715
|
+
// Like all `resource*` methods, `resourceDelete` is symmetrical and MAY be
|
|
716
|
+
// sent in either direction.
|
|
717
|
+
type ResourceDeleteParams struct {
|
|
718
|
+
// Channel URI this command targets.
|
|
719
|
+
Channel URI `json:"channel"`
|
|
720
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
721
|
+
// Receivers MUST ignore keys they do not understand.
|
|
722
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
723
|
+
// URI of the resource to delete
|
|
724
|
+
Uri URI `json:"uri"`
|
|
725
|
+
// If `true` and the target is a directory, delete it and all its contents
|
|
726
|
+
// recursively. If `false` (default), deleting a non-empty directory MUST fail.
|
|
727
|
+
Recursive *bool `json:"recursive,omitempty"`
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// Result of the `resourceDelete` command.
|
|
731
|
+
//
|
|
732
|
+
// An empty object on success.
|
|
733
|
+
type ResourceDeleteResult struct {
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// Moves (renames) a resource from one URI to another on the server's filesystem.
|
|
737
|
+
//
|
|
738
|
+
// If the destination already exists, it is overwritten unless `failIfExists`
|
|
739
|
+
// is set.
|
|
740
|
+
//
|
|
741
|
+
// Like all `resource*` methods, `resourceMove` is symmetrical and MAY be
|
|
742
|
+
// sent in either direction.
|
|
743
|
+
type ResourceMoveParams struct {
|
|
744
|
+
// Channel URI this command targets.
|
|
745
|
+
Channel URI `json:"channel"`
|
|
746
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
747
|
+
// Receivers MUST ignore keys they do not understand.
|
|
748
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
749
|
+
// Source URI to move from
|
|
750
|
+
Source URI `json:"source"`
|
|
751
|
+
// Destination URI to move to
|
|
752
|
+
Destination URI `json:"destination"`
|
|
753
|
+
// If `true`, the server MUST fail if the destination already exists instead
|
|
754
|
+
// of overwriting it.
|
|
755
|
+
FailIfExists *bool `json:"failIfExists,omitempty"`
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// Result of the `resourceMove` command.
|
|
759
|
+
//
|
|
760
|
+
// An empty object on success.
|
|
761
|
+
type ResourceMoveResult struct {
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
// Resolves a resource — the combination of POSIX `stat` and `realpath`.
|
|
765
|
+
//
|
|
766
|
+
// `resourceResolve` returns metadata about the resource together with its
|
|
767
|
+
// canonical URI after symlink resolution. Use this in place of any
|
|
768
|
+
// `resourceExists` shim: a missing resource MUST surface as a `NotFound`
|
|
769
|
+
// JSON-RPC error rather than a success with a sentinel value. Callers that
|
|
770
|
+
// truly need a boolean check should attempt `resourceResolve` and treat
|
|
771
|
+
// `NotFound` as "does not exist".
|
|
772
|
+
//
|
|
773
|
+
// Like all `resource*` methods, `resourceResolve` is symmetrical and MAY be
|
|
774
|
+
// sent in either direction.
|
|
775
|
+
type ResourceResolveParams struct {
|
|
776
|
+
// Channel URI this command targets.
|
|
777
|
+
Channel URI `json:"channel"`
|
|
778
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
779
|
+
// Receivers MUST ignore keys they do not understand.
|
|
780
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
781
|
+
// URI to resolve
|
|
782
|
+
Uri URI `json:"uri"`
|
|
783
|
+
// When `true` (default), follow symlinks and report the metadata of the
|
|
784
|
+
// link target — and set `uri` in the result to the canonical (realpath)
|
|
785
|
+
// URI. When `false`, stat the link itself (lstat semantics) and report
|
|
786
|
+
// `type: 'symlink'`.
|
|
787
|
+
FollowSymlinks *bool `json:"followSymlinks,omitempty"`
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
// Result of the `resourceResolve` command.
|
|
791
|
+
type ResourceResolveResult struct {
|
|
792
|
+
// Canonical URI after symlink resolution. Equal to the requested URI when
|
|
793
|
+
// `followSymlinks` is `false` or the URI does not traverse a symlink.
|
|
794
|
+
Uri URI `json:"uri"`
|
|
795
|
+
// Resource kind.
|
|
796
|
+
Type ResourceType `json:"type"`
|
|
797
|
+
// Size in bytes. Omitted for directories when the provider cannot
|
|
798
|
+
// cheaply compute it.
|
|
799
|
+
Size *int64 `json:"size,omitempty"`
|
|
800
|
+
// Last-modified time in ISO 8601 format, when known.
|
|
801
|
+
Mtime *string `json:"mtime,omitempty"`
|
|
802
|
+
// Creation time in ISO 8601 format, when known.
|
|
803
|
+
Ctime *string `json:"ctime,omitempty"`
|
|
804
|
+
// Sniffed MIME type, when known (e.g. `"text/plain"`, `"image/png"`).
|
|
805
|
+
ContentType *string `json:"contentType,omitempty"`
|
|
806
|
+
// Opaque per-provider version token. When present, pass it as
|
|
807
|
+
// {@link ResourceWriteParams.ifMatch} on a subsequent `resourceWrite` to
|
|
808
|
+
// detect concurrent modifications.
|
|
809
|
+
Etag *string `json:"etag,omitempty"`
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
// Creates a directory on the server's filesystem with `mkdir -p` semantics.
|
|
813
|
+
//
|
|
814
|
+
// The server MUST create any missing parent directories. Creating a
|
|
815
|
+
// directory that already exists is a no-op success. If `uri` already
|
|
816
|
+
// exists but is **not** a directory, the server MUST fail with
|
|
817
|
+
// `AlreadyExists`.
|
|
818
|
+
//
|
|
819
|
+
// Like all `resource*` methods, `resourceMkdir` is symmetrical and MAY be
|
|
820
|
+
// sent in either direction.
|
|
821
|
+
type ResourceMkdirParams struct {
|
|
822
|
+
// Channel URI this command targets.
|
|
823
|
+
Channel URI `json:"channel"`
|
|
824
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
825
|
+
// Receivers MUST ignore keys they do not understand.
|
|
826
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
827
|
+
// Directory URI to create (parents created as needed).
|
|
828
|
+
Uri URI `json:"uri"`
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
// Result of the `resourceMkdir` command.
|
|
832
|
+
//
|
|
833
|
+
// An empty object on success.
|
|
834
|
+
type ResourceMkdirResult struct {
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
// Requests permission to access a resource on the receiver's filesystem.
|
|
838
|
+
//
|
|
839
|
+
// `resourceRequest` is symmetrical and MAY be sent in either direction: a
|
|
840
|
+
// client asks the server to grant access to a server-side resource, or a
|
|
841
|
+
// server asks the client to grant access to a client-side resource. The
|
|
842
|
+
// receiver decides whether to allow, deny, or prompt the user for the
|
|
843
|
+
// requested access.
|
|
844
|
+
//
|
|
845
|
+
// If the receiver denies access, it MUST respond with `PermissionDenied`
|
|
846
|
+
// (-32009). The error data MAY include a `ResourceRequestParams` value
|
|
847
|
+
// describing the access the caller would need to be granted for the
|
|
848
|
+
// operation to succeed; see `PermissionDeniedErrorData` in
|
|
849
|
+
// `types/errors.ts`.
|
|
850
|
+
//
|
|
851
|
+
// After a successful `resourceRequest`, the caller MAY use the corresponding
|
|
852
|
+
// `resource*` commands (e.g. `resourceRead`, `resourceWrite`) to perform the
|
|
853
|
+
// operation. Receivers MAY rescind access at any time by returning
|
|
854
|
+
// `PermissionDenied` on subsequent operations.
|
|
855
|
+
//
|
|
856
|
+
// Either `read`, `write`, or both SHOULD be set to `true`. A request with
|
|
857
|
+
// neither flag set is treated as `read: true` by receivers.
|
|
858
|
+
type ResourceRequestParams struct {
|
|
859
|
+
// Channel URI this command targets.
|
|
860
|
+
Channel URI `json:"channel"`
|
|
861
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
862
|
+
// Receivers MUST ignore keys they do not understand.
|
|
863
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
864
|
+
// Resource URI being requested. Typically a `file:` URI on the receiver's
|
|
865
|
+
// filesystem, but any URI scheme that the receiver mediates access to is
|
|
866
|
+
// allowed.
|
|
867
|
+
Uri URI `json:"uri"`
|
|
868
|
+
// Whether the caller needs read access to the resource.
|
|
869
|
+
Read *bool `json:"read,omitempty"`
|
|
870
|
+
// Whether the caller needs write access to the resource.
|
|
871
|
+
Write *bool `json:"write,omitempty"`
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
// Result of the `resourceRequest` command.
|
|
875
|
+
//
|
|
876
|
+
// An empty object on success.
|
|
877
|
+
type ResourceRequestResult struct {
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// Creates a resource watcher on the receiver's filesystem.
|
|
881
|
+
//
|
|
882
|
+
// The receiver allocates an `ahp-resource-watch:/<id>` channel URI and
|
|
883
|
+
// returns it on {@link CreateResourceWatchResult.channel}. The caller then
|
|
884
|
+
// [`subscribe`](/specification/subscriptions#subscribe-request)s to that channel to receive
|
|
885
|
+
// `resourceWatch/changed` actions over the standard action envelope.
|
|
886
|
+
//
|
|
887
|
+
// The watch lifecycle is tied to subscription: when every subscriber has
|
|
888
|
+
// unsubscribed (or the underlying connection drops), the receiver MUST
|
|
889
|
+
// release the watcher. There is no explicit dispose command — `unsubscribe`
|
|
890
|
+
// is the only handle the caller needs.
|
|
891
|
+
//
|
|
892
|
+
// Like the rest of the `resource*` family, `createResourceWatch` is
|
|
893
|
+
// symmetrical and MAY be sent in either direction. Access is gated through
|
|
894
|
+
// the same permission flow as `resourceRead`/`resourceWrite`.
|
|
895
|
+
type CreateResourceWatchParams struct {
|
|
896
|
+
// Channel URI this command targets.
|
|
897
|
+
Channel URI `json:"channel"`
|
|
898
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
899
|
+
// Receivers MUST ignore keys they do not understand.
|
|
900
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
901
|
+
// URI to watch.
|
|
902
|
+
Uri URI `json:"uri"`
|
|
903
|
+
// If `true`, the receiver MUST report changes for descendants of `uri`.
|
|
904
|
+
// If `false` (default), only changes to `uri` itself — and, when `uri`
|
|
905
|
+
// is a directory, its direct children — are reported.
|
|
906
|
+
Recursive *bool `json:"recursive,omitempty"`
|
|
907
|
+
// Glob patterns or paths relative to `uri` to exclude from reporting.
|
|
908
|
+
// Wrapped in `{ items }` for forward compatibility.
|
|
909
|
+
Excludes *json.RawMessage `json:"excludes,omitempty"`
|
|
910
|
+
// Glob patterns or paths relative to `uri` to restrict reporting to.
|
|
911
|
+
// Omit to report every change under `uri` subject to `excludes`.
|
|
912
|
+
// Wrapped in `{ items }` for forward compatibility.
|
|
913
|
+
Includes *json.RawMessage `json:"includes,omitempty"`
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
// Result of the `createResourceWatch` command.
|
|
917
|
+
type CreateResourceWatchResult struct {
|
|
918
|
+
// Receiver-assigned watch channel URI (`ahp-resource-watch:/<id>`). The
|
|
919
|
+
// caller subscribes to this URI to start receiving change events and
|
|
920
|
+
// unsubscribes to release the watcher.
|
|
921
|
+
Channel URI `json:"channel"`
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
// Requests that the host load older historical turns into a chat state.
|
|
925
|
+
//
|
|
926
|
+
// The command result does not carry turns. Instead, before responding, the host
|
|
927
|
+
// MUST dispatch `chat/turnsLoaded` to insert any loaded turns into the chat
|
|
928
|
+
// channel's `turns` state, ahead of the already-loaded window, and update or
|
|
929
|
+
// clear `turnsNextCursor`.
|
|
930
|
+
//
|
|
931
|
+
// Before applying any operation that references a turn outside the currently
|
|
932
|
+
// loaded window, the host MUST eagerly load enough older turns into state for
|
|
933
|
+
// that operation to reduce against valid state.
|
|
934
|
+
type FetchTurnsParams struct {
|
|
935
|
+
// Channel URI this command targets.
|
|
936
|
+
Channel URI `json:"channel"`
|
|
937
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
938
|
+
// Receivers MUST ignore keys they do not understand.
|
|
939
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
940
|
+
// Opaque cursor from `ChatState.turnsNextCursor`.
|
|
941
|
+
//
|
|
942
|
+
// The host MUST reject unrecognised cursors with `InvalidParams`. Omit only
|
|
943
|
+
// when asking the host to opportunistically load its next older page for the
|
|
944
|
+
// chat, if any.
|
|
945
|
+
Cursor *string `json:"cursor,omitempty"`
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
// Result of the `fetchTurns` command.
|
|
949
|
+
type FetchTurnsResult struct {
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
// Stop receiving updates for a channel.
|
|
953
|
+
type UnsubscribeParams struct {
|
|
954
|
+
// Channel URI to unsubscribe from
|
|
955
|
+
Channel URI `json:"channel"`
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
// Fire-and-forget action dispatch (write-ahead). The client applies actions
|
|
959
|
+
// optimistically to local state and the server echoes them back as an
|
|
960
|
+
// {@link ActionEnvelope} once accepted.
|
|
961
|
+
//
|
|
962
|
+
// The client → server method is named `dispatchAction`; the server's reply
|
|
963
|
+
// arrives on the server → client `action` notification (params:
|
|
964
|
+
// {@link ActionEnvelope}).
|
|
965
|
+
type DispatchActionParams struct {
|
|
966
|
+
// Channel URI this action targets
|
|
967
|
+
Channel URI `json:"channel"`
|
|
968
|
+
// Client sequence number
|
|
969
|
+
ClientSeq int64 `json:"clientSeq"`
|
|
970
|
+
// The action to dispatch
|
|
971
|
+
Action StateAction `json:"action"`
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
// Pushes a Bearer token for a protected resource. The `resource` field MUST
|
|
975
|
+
// match a protected-resource identifier the client has discovered from the
|
|
976
|
+
// server — whether declared statically in `AgentInfo.protectedResources`,
|
|
977
|
+
// or discovered dynamically from a live `McpServerAuthRequiredState.resource`
|
|
978
|
+
// or `ToolCallAuthRequiredState.auth.resource` (both surfaced only once the
|
|
979
|
+
// corresponding MCP server or tool call actually challenges for auth).
|
|
980
|
+
// Servers MUST accept any `resource` value they have themselves advertised
|
|
981
|
+
// through one of these three mechanisms.
|
|
982
|
+
//
|
|
983
|
+
// Tokens are delivered using [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750)
|
|
984
|
+
// (Bearer Token Usage) semantics. The client obtains the token from the
|
|
985
|
+
// authorization server(s) listed in the resource's metadata and pushes it
|
|
986
|
+
// to the server via this command.
|
|
987
|
+
type AuthenticateParams struct {
|
|
988
|
+
// Channel URI this command targets.
|
|
989
|
+
Channel URI `json:"channel"`
|
|
990
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
991
|
+
// Receivers MUST ignore keys they do not understand.
|
|
992
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
993
|
+
// The protected resource identifier. MUST match a `resource` value the
|
|
994
|
+
// server has advertised — via `ProtectedResourceMetadata` in
|
|
995
|
+
// `AgentInfo.protectedResources`, or via a live
|
|
996
|
+
// `McpServerAuthRequiredState.resource` / `ToolCallAuthRequiredState.auth.resource`.
|
|
997
|
+
Resource string `json:"resource"`
|
|
998
|
+
// Bearer token obtained from the resource's authorization server
|
|
999
|
+
Token string `json:"token"`
|
|
1000
|
+
// The access token's remaining lifetime, in seconds, when this
|
|
1001
|
+
// `authenticate` request is sent. This corresponds to `expires_in` in an
|
|
1002
|
+
// OAuth 2.0 token response (RFC 6749 section 5.1).
|
|
1003
|
+
//
|
|
1004
|
+
// If the client retained the original token response, it MUST subtract the
|
|
1005
|
+
// elapsed time before forwarding this value. Omit this field when the
|
|
1006
|
+
// authorization server did not supply an expiry or the expiry is otherwise
|
|
1007
|
+
// unknown. When supplied, the value MUST be a positive integer.
|
|
1008
|
+
//
|
|
1009
|
+
// This field is irrelevant when `token` is empty to revoke authentication
|
|
1010
|
+
// and SHOULD be omitted in that case.
|
|
1011
|
+
ExpiresIn *int64 `json:"expiresIn,omitempty"`
|
|
1012
|
+
// OAuth scopes the token grants, when known. Lets the server determine
|
|
1013
|
+
// whether a specific challenge — e.g. the `requiredScopes` on a live
|
|
1014
|
+
// `McpServerAuthRequiredState` or `ToolCallAuthRequiredState.auth` — is
|
|
1015
|
+
// satisfied without decoding the (opaque, server-specific) token itself.
|
|
1016
|
+
// Omit when the client doesn't track granted scopes separately from the
|
|
1017
|
+
// token.
|
|
1018
|
+
Scopes []string `json:"scopes,omitempty"`
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
// Result of the `authenticate` command.
|
|
1022
|
+
//
|
|
1023
|
+
// An empty object on success. If the token is invalid or the resource is
|
|
1024
|
+
// unrecognized, the server MUST return a JSON-RPC error (e.g. `AuthRequired`
|
|
1025
|
+
// `-32007` or `InvalidParams` `-32602`).
|
|
1026
|
+
type AuthenticateResult struct {
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
// Creates a new terminal on the server.
|
|
1030
|
+
//
|
|
1031
|
+
// After creation, the client should subscribe to the terminal URI to receive
|
|
1032
|
+
// state updates. The server dispatches `root/terminalsChanged` to update the
|
|
1033
|
+
// root terminal list.
|
|
1034
|
+
type CreateTerminalParams struct {
|
|
1035
|
+
// Channel URI this command targets.
|
|
1036
|
+
Channel URI `json:"channel"`
|
|
1037
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
1038
|
+
// Receivers MUST ignore keys they do not understand.
|
|
1039
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
1040
|
+
// Initial owner of the terminal
|
|
1041
|
+
Claim TerminalClaim `json:"claim"`
|
|
1042
|
+
// Human-readable terminal name
|
|
1043
|
+
Name *string `json:"name,omitempty"`
|
|
1044
|
+
// Initial working directory URI
|
|
1045
|
+
Cwd *URI `json:"cwd,omitempty"`
|
|
1046
|
+
// Initial terminal width in columns
|
|
1047
|
+
Cols *int64 `json:"cols,omitempty"`
|
|
1048
|
+
// Initial terminal height in rows
|
|
1049
|
+
Rows *int64 `json:"rows,omitempty"`
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
// Disposes a terminal and kills its process if still running.
|
|
1053
|
+
//
|
|
1054
|
+
// The server dispatches `root/terminalsChanged` to remove the terminal from
|
|
1055
|
+
// the root terminal list.
|
|
1056
|
+
type DisposeTerminalParams struct {
|
|
1057
|
+
// Channel URI this command targets.
|
|
1058
|
+
Channel URI `json:"channel"`
|
|
1059
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
1060
|
+
// Receivers MUST ignore keys they do not understand.
|
|
1061
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
// Iteratively resolves the session configuration schema. The client sends the
|
|
1065
|
+
// current partial session config and any user-filled metadata values. The server
|
|
1066
|
+
// returns a property schema describing what additional metadata is needed,
|
|
1067
|
+
// contextual to the current selections.
|
|
1068
|
+
//
|
|
1069
|
+
// The client calls this command whenever the user changes a significant input
|
|
1070
|
+
// (e.g. picks a working directory, toggles a property). Each response returns
|
|
1071
|
+
// the full current property set (not a delta). The returned `values` contain
|
|
1072
|
+
// server-resolved defaults to pass to `createSession`.
|
|
1073
|
+
type ResolveSessionConfigParams struct {
|
|
1074
|
+
// Channel URI this command targets.
|
|
1075
|
+
Channel URI `json:"channel"`
|
|
1076
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
1077
|
+
// Receivers MUST ignore keys they do not understand.
|
|
1078
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
1079
|
+
// Agent provider ID
|
|
1080
|
+
Provider *string `json:"provider,omitempty"`
|
|
1081
|
+
// Working directory for the session
|
|
1082
|
+
WorkingDirectory *URI `json:"workingDirectory,omitempty"`
|
|
1083
|
+
// Current user-filled configuration values
|
|
1084
|
+
Config map[string]json.RawMessage `json:"config,omitempty"`
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
// Result of the `resolveSessionConfig` command.
|
|
1088
|
+
type ResolveSessionConfigResult struct {
|
|
1089
|
+
// JSON Schema describing available configuration properties given the current context
|
|
1090
|
+
Schema SessionConfigSchema `json:"schema"`
|
|
1091
|
+
// Current configuration values (echoed back with server-resolved defaults applied)
|
|
1092
|
+
Values map[string]json.RawMessage `json:"values"`
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
// Queries the server for allowed values of a dynamic session config property.
|
|
1096
|
+
//
|
|
1097
|
+
// Used when a property in the schema returned by `resolveSessionConfig` has
|
|
1098
|
+
// `enumDynamic: true`. The client sends a search query and receives matching
|
|
1099
|
+
// values with display metadata.
|
|
1100
|
+
type SessionConfigCompletionsParams struct {
|
|
1101
|
+
// Channel URI this command targets.
|
|
1102
|
+
Channel URI `json:"channel"`
|
|
1103
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
1104
|
+
// Receivers MUST ignore keys they do not understand.
|
|
1105
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
1106
|
+
// Agent provider ID
|
|
1107
|
+
Provider *string `json:"provider,omitempty"`
|
|
1108
|
+
// Working directory for the session
|
|
1109
|
+
WorkingDirectory *URI `json:"workingDirectory,omitempty"`
|
|
1110
|
+
// Current user-filled configuration values (provides context for the query)
|
|
1111
|
+
Config map[string]json.RawMessage `json:"config,omitempty"`
|
|
1112
|
+
// Property id from the schema to query values for
|
|
1113
|
+
Property string `json:"property"`
|
|
1114
|
+
// Search filter text (empty or omitted returns default/recent values)
|
|
1115
|
+
Query *string `json:"query,omitempty"`
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
// Result of the `sessionConfigCompletions` command.
|
|
1119
|
+
type SessionConfigCompletionsResult struct {
|
|
1120
|
+
// Matching value items
|
|
1121
|
+
Items []SessionConfigValueItem `json:"items"`
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
// A single value item returned by `sessionConfigCompletions`.
|
|
1125
|
+
type SessionConfigValueItem struct {
|
|
1126
|
+
// The value to store in config
|
|
1127
|
+
Value string `json:"value"`
|
|
1128
|
+
// Human-readable display label
|
|
1129
|
+
Label string `json:"label"`
|
|
1130
|
+
// Optional secondary description
|
|
1131
|
+
Description *string `json:"description,omitempty"`
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
// Requests completion items for a partially-typed input (e.g. a user message
|
|
1135
|
+
// the user is currently composing). Used to power `@`-mention pickers,
|
|
1136
|
+
// file/symbol references, and similar inline-completion experiences.
|
|
1137
|
+
//
|
|
1138
|
+
// Servers SHOULD treat this command as best-effort and return promptly. The
|
|
1139
|
+
// client SHOULD debounce calls to avoid flooding the server with requests on
|
|
1140
|
+
// every keystroke.
|
|
1141
|
+
type CompletionsParams struct {
|
|
1142
|
+
// Channel URI this command targets.
|
|
1143
|
+
Channel URI `json:"channel"`
|
|
1144
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
1145
|
+
// Receivers MUST ignore keys they do not understand.
|
|
1146
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
1147
|
+
// What kind of completion is being requested.
|
|
1148
|
+
Kind CompletionItemKind `json:"kind"`
|
|
1149
|
+
// The complete text of the input being completed (e.g. the full user
|
|
1150
|
+
// message text typed so far).
|
|
1151
|
+
Text string `json:"text"`
|
|
1152
|
+
// The character offset within `text` at which the completion is requested,
|
|
1153
|
+
// measured in UTF-16 code units. MUST satisfy `0 <= offset <= text.length`.
|
|
1154
|
+
Offset int64 `json:"offset"`
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
// A single completion item returned by the `completions` command.
|
|
1158
|
+
//
|
|
1159
|
+
// When the user accepts an item, the client SHOULD:
|
|
1160
|
+
// 1. Replace the range `[rangeStart, rangeEnd)` in the input with `insertText`
|
|
1161
|
+
// (or insert `insertText` at the cursor when the range is omitted).
|
|
1162
|
+
// 2. Associate the item's `attachment` with the resulting {@link Message}.
|
|
1163
|
+
type CompletionItem struct {
|
|
1164
|
+
// The text inserted into the input when this item is accepted.
|
|
1165
|
+
InsertText string `json:"insertText"`
|
|
1166
|
+
// If defined, the start of the range in the input's `text` that is replaced
|
|
1167
|
+
// by `insertText`. The range is the half-open interval
|
|
1168
|
+
// `[rangeStart, rangeEnd)` of character offsets, measured in UTF-16 code
|
|
1169
|
+
// units.
|
|
1170
|
+
//
|
|
1171
|
+
// When omitted, the client SHOULD insert `insertText` at the cursor.
|
|
1172
|
+
//
|
|
1173
|
+
// Note: this range refers to positions in the *current* input. The
|
|
1174
|
+
// attachment's own `rangeStart`/`rangeEnd` (when present) refer to
|
|
1175
|
+
// positions in the final {@link Message.text} after the item is
|
|
1176
|
+
// accepted.
|
|
1177
|
+
RangeStart *int64 `json:"rangeStart,omitempty"`
|
|
1178
|
+
// The end of the range in the input's `text` that is replaced by
|
|
1179
|
+
// `insertText`. See {@link rangeStart}.
|
|
1180
|
+
RangeEnd *int64 `json:"rangeEnd,omitempty"`
|
|
1181
|
+
// The attachment associated with this completion item.
|
|
1182
|
+
Attachment MessageAttachment `json:"attachment"`
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
// Result of the `completions` command.
|
|
1186
|
+
type CompletionsResult struct {
|
|
1187
|
+
// The completion items, in the order the server suggests displaying them.
|
|
1188
|
+
Items []CompletionItem `json:"items"`
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
// Invokes a server-defined {@link ChangesetOperation} against a changeset,
|
|
1192
|
+
// a single file, or a line range.
|
|
1193
|
+
//
|
|
1194
|
+
// The server validates that `operationId` exists in the changeset's
|
|
1195
|
+
// current `operations` list and that the requested `target.kind` is
|
|
1196
|
+
// contained in the operation's `scopes`. Invalid combinations result in a
|
|
1197
|
+
// JSON-RPC error.
|
|
1198
|
+
//
|
|
1199
|
+
// State changes resulting from invocation flow back through the normal
|
|
1200
|
+
// `changeset/*` action stream on the relevant changeset URIs. Clients
|
|
1201
|
+
// SHOULD NOT synthesise local optimistic changes for invocations unless
|
|
1202
|
+
// the server explicitly opts in via a future capability.
|
|
1203
|
+
type InvokeChangesetOperationParams struct {
|
|
1204
|
+
// Channel URI this command targets.
|
|
1205
|
+
Channel URI `json:"channel"`
|
|
1206
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
1207
|
+
// Receivers MUST ignore keys they do not understand.
|
|
1208
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
1209
|
+
// Matches {@link ChangesetOperation.id} from the changeset's `operations` list.
|
|
1210
|
+
OperationId string `json:"operationId"`
|
|
1211
|
+
// Target of the operation. Required iff the chosen scope is
|
|
1212
|
+
// `'resource'` or `'range'`. Omit for changeset-scoped operations.
|
|
1213
|
+
Target *ChangesetOperationTarget `json:"target,omitempty"`
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
// Result of the {@link InvokeChangesetOperationParams | `invokeChangesetOperation`}
|
|
1217
|
+
// command.
|
|
1218
|
+
//
|
|
1219
|
+
// Success is implicit: the server returns this result when it accepted
|
|
1220
|
+
// the operation. Failure is signalled by rejecting the JSON-RPC request
|
|
1221
|
+
// with an appropriate error code, not by any field on this result. The
|
|
1222
|
+
// operation MAY still produce subsequent failure feedback through the
|
|
1223
|
+
// {@link ChangesetStatusChangedAction | `changeset/statusChanged`} stream.
|
|
1224
|
+
type InvokeChangesetOperationResult struct {
|
|
1225
|
+
// Optional human-readable message describing the result.
|
|
1226
|
+
Message *StringOrMarkdown `json:"message,omitempty"`
|
|
1227
|
+
// Optional follow-up: a URI to open (e.g. a PR), a content ref, etc.
|
|
1228
|
+
FollowUp *ChangesetOperationFollowUp `json:"followUp,omitempty"`
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
// Optional follow-up surfaced by the server after an operation completes —
|
|
1232
|
+
// a {@link ContentRef} the client can fetch and display.
|
|
1233
|
+
//
|
|
1234
|
+
// Set `external` to `true` to open the content in the user's preferred
|
|
1235
|
+
// external handler (e.g. browser); otherwise the client is expected to
|
|
1236
|
+
// surface it inline.
|
|
1237
|
+
type ChangesetOperationFollowUp struct {
|
|
1238
|
+
Content ContentRef `json:"content"`
|
|
1239
|
+
// When `true`, open in an external handler rather than inline.
|
|
1240
|
+
External *bool `json:"external,omitempty"`
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
// Discover event-trigger types available for a prospective session template.
|
|
1244
|
+
//
|
|
1245
|
+
// Hosts may vary definitions by provider, workspace, and session
|
|
1246
|
+
// configuration. Schedule triggers are protocol-defined and therefore do not
|
|
1247
|
+
// appear in this result. The result describes current authoring and validation
|
|
1248
|
+
// choices. Saved {@link AutomationEventTrigger} values retain their selected
|
|
1249
|
+
// event descriptors for display but do not establish current availability.
|
|
1250
|
+
type ListAutomationTriggerDefinitionsParams struct {
|
|
1251
|
+
// Channel URI this command targets.
|
|
1252
|
+
Channel URI `json:"channel"`
|
|
1253
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
1254
|
+
// Receivers MUST ignore keys they do not understand.
|
|
1255
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
1256
|
+
// Prospective provider id matching {@link AgentInfo.provider}, or omitted for the host default.
|
|
1257
|
+
Provider *string `json:"provider,omitempty"`
|
|
1258
|
+
// Prospective {@link AutomationSessionTemplate.workingDirectories}.
|
|
1259
|
+
WorkingDirectories []URI `json:"workingDirectories,omitempty"`
|
|
1260
|
+
// Prospective resolved {@link AutomationSessionTemplate.config}.
|
|
1261
|
+
SessionConfig map[string]json.RawMessage `json:"sessionConfig,omitempty"`
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
// Host-defined event trigger types available for the supplied context.
|
|
1265
|
+
type ListAutomationTriggerDefinitionsResult struct {
|
|
1266
|
+
// Available event trigger definitions.
|
|
1267
|
+
Items []AutomationTriggerDefinition `json:"items"`
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
// Start a manual run of an automation.
|
|
1271
|
+
//
|
|
1272
|
+
// Manual execution is independent of {@link AutomationDefinition.enabled}.
|
|
1273
|
+
// The host persists the run before beginning session side effects.
|
|
1274
|
+
type RunAutomationParams struct {
|
|
1275
|
+
// Channel URI this command targets.
|
|
1276
|
+
Channel URI `json:"channel"`
|
|
1277
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
1278
|
+
// Receivers MUST ignore keys they do not understand.
|
|
1279
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
1280
|
+
// Target {@link AutomationEntry.resource}.
|
|
1281
|
+
Automation URI `json:"automation"`
|
|
1282
|
+
// Durable client-generated idempotency key. Retrying with the same key and
|
|
1283
|
+
// automation MUST return the original run URI rather than create another
|
|
1284
|
+
// run.
|
|
1285
|
+
RequestId string `json:"requestId"`
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
// Result identifying the existing or newly created run.
|
|
1289
|
+
type RunAutomationResult struct {
|
|
1290
|
+
// Subscribable `ahp-automation-run:` URI matching {@link AutomationRunState.resource}.
|
|
1291
|
+
Resource URI `json:"resource"`
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
// Load one older page into a catalogued automation's run-history state.
|
|
1295
|
+
//
|
|
1296
|
+
// The response only acknowledges the request. The updated full state arrives
|
|
1297
|
+
// through {@link AutomationSetAction | `automation/set`} on the
|
|
1298
|
+
// `ahp-automations://` channel, keeping all catalogue subscribers synchronized
|
|
1299
|
+
// through the normal action stream.
|
|
1300
|
+
type FetchAutomationRunsParams struct {
|
|
1301
|
+
// Channel URI this command targets.
|
|
1302
|
+
Channel URI `json:"channel"`
|
|
1303
|
+
// Optional JSON-serializable metadata associated with this request.
|
|
1304
|
+
// Receivers MUST ignore keys they do not understand.
|
|
1305
|
+
Meta map[string]json.RawMessage `json:"_meta,omitempty"`
|
|
1306
|
+
// Target {@link AutomationEntry.resource}.
|
|
1307
|
+
Automation URI `json:"automation"`
|
|
1308
|
+
// Cursor previously received as {@link AutomationEntry.runsNextCursor}.
|
|
1309
|
+
// Omit to request the first page not already included by the snapshot.
|
|
1310
|
+
Cursor *string `json:"cursor,omitempty"`
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
// Empty acknowledgement; the updated automation state is delivered by action.
|
|
1314
|
+
type FetchAutomationRunsResult struct {
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
func (v *ForkChatSource) UnmarshalJSON(data []byte) error {
|
|
1318
|
+
disc, ok, err := readDiscriminator(data, "kind")
|
|
1319
|
+
if err != nil {
|
|
1320
|
+
return err
|
|
1321
|
+
}
|
|
1322
|
+
if !ok {
|
|
1323
|
+
return missingDiscriminatorError("ForkChatSource", "kind")
|
|
1324
|
+
}
|
|
1325
|
+
if disc != "fork" {
|
|
1326
|
+
return unknownDiscriminatorError("ForkChatSource", "kind", disc)
|
|
1327
|
+
}
|
|
1328
|
+
type wire ForkChatSource
|
|
1329
|
+
var raw wire
|
|
1330
|
+
if err := json.Unmarshal(data, &raw); err != nil {
|
|
1331
|
+
return err
|
|
1332
|
+
}
|
|
1333
|
+
*v = ForkChatSource(raw)
|
|
1334
|
+
v.Kind = ChatSourceKindFork
|
|
1335
|
+
return nil
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
func (v ForkChatSource) MarshalJSON() ([]byte, error) {
|
|
1339
|
+
type wire ForkChatSource
|
|
1340
|
+
raw := wire(v)
|
|
1341
|
+
raw.Kind = ChatSourceKindFork
|
|
1342
|
+
return json.Marshal(raw)
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
func (v *SideChatSource) UnmarshalJSON(data []byte) error {
|
|
1346
|
+
disc, ok, err := readDiscriminator(data, "kind")
|
|
1347
|
+
if err != nil {
|
|
1348
|
+
return err
|
|
1349
|
+
}
|
|
1350
|
+
if !ok {
|
|
1351
|
+
return missingDiscriminatorError("SideChatSource", "kind")
|
|
1352
|
+
}
|
|
1353
|
+
if disc != "sideChat" {
|
|
1354
|
+
return unknownDiscriminatorError("SideChatSource", "kind", disc)
|
|
1355
|
+
}
|
|
1356
|
+
type wire SideChatSource
|
|
1357
|
+
var raw wire
|
|
1358
|
+
if err := json.Unmarshal(data, &raw); err != nil {
|
|
1359
|
+
return err
|
|
1360
|
+
}
|
|
1361
|
+
*v = SideChatSource(raw)
|
|
1362
|
+
v.Kind = ChatSourceKindSideChat
|
|
1363
|
+
return nil
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
func (v SideChatSource) MarshalJSON() ([]byte, error) {
|
|
1367
|
+
type wire SideChatSource
|
|
1368
|
+
raw := wire(v)
|
|
1369
|
+
raw.Kind = ChatSourceKindSideChat
|
|
1370
|
+
return json.Marshal(raw)
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
// ─── ChatSource Union ─────────────────────────────────────────────────
|
|
1374
|
+
|
|
1375
|
+
// ChatSource identifies how a new chat uses a source chat.
|
|
1376
|
+
type ChatSource struct {
|
|
1377
|
+
Value isChatSource
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
// isChatSource is the marker interface implemented by every
|
|
1381
|
+
// concrete variant of ChatSource.
|
|
1382
|
+
type isChatSource interface{ isChatSource() }
|
|
1383
|
+
|
|
1384
|
+
func (*ForkChatSource) isChatSource() {}
|
|
1385
|
+
func (*SideChatSource) isChatSource() {}
|
|
1386
|
+
|
|
1387
|
+
// ChatSourceUnknown carries an unrecognized ChatSource variant — typically a discriminator value introduced by a newer protocol version. The original JSON object is preserved verbatim so that re-encoding round-trips faithfully.
|
|
1388
|
+
type ChatSourceUnknown struct {
|
|
1389
|
+
Raw json.RawMessage
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
func (*ChatSourceUnknown) isChatSource() {}
|
|
1393
|
+
|
|
1394
|
+
// UnmarshalJSON decodes the variant indicated by the "kind" discriminator.
|
|
1395
|
+
func (u *ChatSource) UnmarshalJSON(data []byte) error {
|
|
1396
|
+
disc, _, err := readDiscriminator(data, "kind")
|
|
1397
|
+
if err != nil {
|
|
1398
|
+
return err
|
|
1399
|
+
}
|
|
1400
|
+
switch disc {
|
|
1401
|
+
case "fork":
|
|
1402
|
+
var value ForkChatSource
|
|
1403
|
+
if err := json.Unmarshal(data, &value); err != nil {
|
|
1404
|
+
return err
|
|
1405
|
+
}
|
|
1406
|
+
u.Value = &value
|
|
1407
|
+
case "sideChat":
|
|
1408
|
+
var value SideChatSource
|
|
1409
|
+
if err := json.Unmarshal(data, &value); err != nil {
|
|
1410
|
+
return err
|
|
1411
|
+
}
|
|
1412
|
+
u.Value = &value
|
|
1413
|
+
default:
|
|
1414
|
+
raw := make(json.RawMessage, len(data))
|
|
1415
|
+
copy(raw, data)
|
|
1416
|
+
u.Value = &ChatSourceUnknown{Raw: raw}
|
|
1417
|
+
}
|
|
1418
|
+
return nil
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
// MarshalJSON encodes the active variant back to JSON.
|
|
1422
|
+
func (u ChatSource) MarshalJSON() ([]byte, error) {
|
|
1423
|
+
if unk, ok := u.Value.(*ChatSourceUnknown); ok {
|
|
1424
|
+
if len(unk.Raw) == 0 {
|
|
1425
|
+
return []byte("null"), nil
|
|
1426
|
+
}
|
|
1427
|
+
return unk.Raw, nil
|
|
1428
|
+
}
|
|
1429
|
+
if u.Value == nil {
|
|
1430
|
+
return []byte("null"), nil
|
|
1431
|
+
}
|
|
1432
|
+
return json.Marshal(u.Value)
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
// ─── ReconnectResult Union ────────────────────────────────────────────
|
|
1436
|
+
|
|
1437
|
+
// ReconnectResult is the result of the `reconnect` command.
|
|
1438
|
+
type ReconnectResult struct {
|
|
1439
|
+
Value isReconnectResult
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
// isReconnectResult is the marker interface implemented by every
|
|
1443
|
+
// concrete variant of ReconnectResult.
|
|
1444
|
+
type isReconnectResult interface{ isReconnectResult() }
|
|
1445
|
+
|
|
1446
|
+
func (*ReconnectReplayResult) isReconnectResult() {}
|
|
1447
|
+
func (*ReconnectSnapshotResult) isReconnectResult() {}
|
|
1448
|
+
|
|
1449
|
+
// UnmarshalJSON decodes the variant indicated by the "type" discriminator.
|
|
1450
|
+
func (u *ReconnectResult) UnmarshalJSON(data []byte) error {
|
|
1451
|
+
disc, ok, err := readDiscriminator(data, "type")
|
|
1452
|
+
if err != nil {
|
|
1453
|
+
return err
|
|
1454
|
+
}
|
|
1455
|
+
if !ok {
|
|
1456
|
+
return missingDiscriminatorError("ReconnectResult", "type")
|
|
1457
|
+
}
|
|
1458
|
+
switch disc {
|
|
1459
|
+
case "replay":
|
|
1460
|
+
var value ReconnectReplayResult
|
|
1461
|
+
if err := json.Unmarshal(data, &value); err != nil {
|
|
1462
|
+
return err
|
|
1463
|
+
}
|
|
1464
|
+
u.Value = &value
|
|
1465
|
+
case "snapshot":
|
|
1466
|
+
var value ReconnectSnapshotResult
|
|
1467
|
+
if err := json.Unmarshal(data, &value); err != nil {
|
|
1468
|
+
return err
|
|
1469
|
+
}
|
|
1470
|
+
u.Value = &value
|
|
1471
|
+
default:
|
|
1472
|
+
return unknownDiscriminatorError("ReconnectResult", "type", disc)
|
|
1473
|
+
}
|
|
1474
|
+
return nil
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
// MarshalJSON encodes the active variant back to JSON.
|
|
1478
|
+
func (u ReconnectResult) MarshalJSON() ([]byte, error) {
|
|
1479
|
+
if u.Value == nil {
|
|
1480
|
+
return []byte("null"), nil
|
|
1481
|
+
}
|
|
1482
|
+
return json.Marshal(u.Value)
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
// ─── Changeset Operation Unions ───────────────────────────────────────
|
|
1486
|
+
|
|
1487
|
+
// ChangesetOperationTarget identifies the file or range a
|
|
1488
|
+
// ChangesetOperation should act on.
|
|
1489
|
+
type ChangesetOperationTarget struct {
|
|
1490
|
+
Value isChangesetOperationTarget
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
// isChangesetOperationTarget is the marker interface for the two variants.
|
|
1494
|
+
type isChangesetOperationTarget interface{ isChangesetOperationTarget() }
|
|
1495
|
+
|
|
1496
|
+
// ChangesetOperationResourceTarget targets an entire resource.
|
|
1497
|
+
type ChangesetOperationResourceTarget struct {
|
|
1498
|
+
Kind string `json:"kind"`
|
|
1499
|
+
Resource URI `json:"resource"`
|
|
1500
|
+
Side *string `json:"side,omitempty"`
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
func (*ChangesetOperationResourceTarget) isChangesetOperationTarget() {}
|
|
1504
|
+
|
|
1505
|
+
// ChangesetOperationRangeTarget targets a range within a resource.
|
|
1506
|
+
type ChangesetOperationRangeTarget struct {
|
|
1507
|
+
Kind string `json:"kind"`
|
|
1508
|
+
Resource URI `json:"resource"`
|
|
1509
|
+
Side *string `json:"side,omitempty"`
|
|
1510
|
+
Range TextRange `json:"range"`
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
func (*ChangesetOperationRangeTarget) isChangesetOperationTarget() {}
|
|
1514
|
+
|
|
1515
|
+
// UnmarshalJSON dispatches on the `kind` discriminator.
|
|
1516
|
+
func (t *ChangesetOperationTarget) UnmarshalJSON(data []byte) error {
|
|
1517
|
+
disc, _, err := readDiscriminator(data, "kind")
|
|
1518
|
+
if err != nil {
|
|
1519
|
+
return err
|
|
1520
|
+
}
|
|
1521
|
+
switch disc {
|
|
1522
|
+
case "resource":
|
|
1523
|
+
var v ChangesetOperationResourceTarget
|
|
1524
|
+
if err := json.Unmarshal(data, &v); err != nil {
|
|
1525
|
+
return err
|
|
1526
|
+
}
|
|
1527
|
+
t.Value = &v
|
|
1528
|
+
case "range":
|
|
1529
|
+
var v ChangesetOperationRangeTarget
|
|
1530
|
+
if err := json.Unmarshal(data, &v); err != nil {
|
|
1531
|
+
return err
|
|
1532
|
+
}
|
|
1533
|
+
t.Value = &v
|
|
1534
|
+
default:
|
|
1535
|
+
return &json.UnmarshalTypeError{Value: "ChangesetOperationTarget"}
|
|
1536
|
+
}
|
|
1537
|
+
return nil
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
// MarshalJSON encodes the active variant.
|
|
1541
|
+
func (t ChangesetOperationTarget) MarshalJSON() ([]byte, error) {
|
|
1542
|
+
if t.Value == nil {
|
|
1543
|
+
return []byte("null"), nil
|
|
1544
|
+
}
|
|
1545
|
+
return json.Marshal(t.Value)
|
|
1546
|
+
}
|