@flowy-agent-store/client 0.1.0-beta.6 → 0.1.0-beta.8
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/dist/index.cjs +241 -16
- package/dist/index.d.cts +188 -9
- package/dist/index.d.mts +188 -9
- package/dist/index.mjs +241 -16
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentDetail, AgentRunInput, AgentSummary, AnswerDecisionInput, CancelRunInput, ClientCapabilities, ClientInfo, ConnectorCallResult, ConnectorDetail, ConnectorProbeResult, ConnectorStatusView, ConnectorSummary, ContextUsage, ConversationCreateInput, ConversationEvent, ConversationMessage, ConversationMessagesPage, ConversationMessagesQuery, ConversationModelOptions, ConversationSendReceipt, ConversationUpdateInput, ConversationView, ImportDetail, ImportRequest, ImportResult, ImportSummary, InitializeResult, InstallOutcome, InstallRequest, InstallResult, InstallStatus, MarketplaceAddRequest, MarketplaceDetail, MarketplaceRefreshResult, MarketplaceRemoveResult, MarketplaceSummary, MentionRef, ModelSummary, OAuthStartResult, OAuthStatusView, ProviderWithModel, RunEvent, RunEventsQuery, RunPlan, RunReceipt, RunResult, RunStatus, RunView, ServerNotification, SkillDetail, SkillFileContent, SkillFileList, SkillSummary, SteerRunInput, StoreInstallResult, StoreItem, StoreItemKind, StoreList, TeamDetail, TeamRunInput, TeamRunReceipt, TeamSummary, WorkspaceRevokeResult, WorkspaceView } from "@flowy-agent-store/protocol";
|
|
1
|
+
import { AgentDetail, AgentRunInput, AgentSummary, AnswerDecisionInput, CancelRunInput, ClientCapabilities, ClientInfo, ConnectorCallResult, ConnectorCredential, ConnectorDetail, ConnectorProbeResult, ConnectorRegistration, ConnectorStatusView, ConnectorSummary, ContextUsage, ConversationCreateInput, ConversationEvent, ConversationMessage, ConversationMessagesPage, ConversationMessagesQuery, ConversationModelOptions, ConversationSendReceipt, ConversationUpdateInput, ConversationView, ExpertPack, ImportDetail, ImportRequest, ImportResult, ImportSummary, InitializeResult, InstallOutcome, InstallRequest, InstallResult, InstallStatus, MarketplaceAddRequest, MarketplaceDetail, MarketplaceRefreshResult, MarketplaceRemoveResult, MarketplaceSummary, MentionRef, ModelSummary, OAuthStartResult, OAuthStatusView, ProviderWithModel, RunEvent, RunEventsQuery, RunPlan, RunReceipt, RunResult, RunStatus, RunView, ServerNotification, SkillDetail, SkillFileContent, SkillFileList, SkillSummary, SteerRunInput, StoreInstallResult, StoreItem, StoreItemKind, StoreList, TeamDetail, TeamRunInput, TeamRunReceipt, TeamSummary, WorkspaceRevokeResult, WorkspaceView } from "@flowy-agent-store/protocol";
|
|
2
2
|
//#region src/transport.d.ts
|
|
3
3
|
export type NotificationListener = (notification: ServerNotification) => void;
|
|
4
4
|
/**
|
|
@@ -193,6 +193,17 @@ export declare class AgentClient {
|
|
|
193
193
|
list(): Promise<AgentSummary[]>;
|
|
194
194
|
/** Fetch one AgentDefinition; raw prompts never cross the wire. */
|
|
195
195
|
get(agentId: string): Promise<AgentDetail>;
|
|
196
|
+
/**
|
|
197
|
+
* Export one AgentDefinition as a portable {@link ExpertPack}.
|
|
198
|
+
*
|
|
199
|
+
* Requires WebSocket: like the rest of this family, `agent/export` has no HTTP
|
|
200
|
+
* route. The expert must be installed and enabled, or the host answers
|
|
201
|
+
* `agent_not_installed` / `agent_disabled`; a host whose `[expert_export]`
|
|
202
|
+
* table refuses the id answers `policy_denied`. Check
|
|
203
|
+
* `capabilities.expert_export` for the *seam* — it does not promise this id is
|
|
204
|
+
* exportable.
|
|
205
|
+
*/
|
|
206
|
+
export(agentId: string): Promise<ExpertPack>;
|
|
196
207
|
}
|
|
197
208
|
//#endregion
|
|
198
209
|
//#region src/conversations.d.ts
|
|
@@ -363,6 +374,28 @@ export declare class ConversationSubscription {
|
|
|
363
374
|
}
|
|
364
375
|
//#endregion
|
|
365
376
|
//#region src/connectors.d.ts
|
|
377
|
+
export interface WaitForAuthOptions {
|
|
378
|
+
/** Overall budget in ms; defaults to `DEFAULT_AUTH_TIMEOUT_MS` (120s). */
|
|
379
|
+
timeoutMs?: number;
|
|
380
|
+
/** Poll interval in ms; defaults to 500. The read is a local DB projection. */
|
|
381
|
+
pollMs?: number;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* How a completed wait ended.
|
|
385
|
+
*
|
|
386
|
+
* `error` carries the host's own sentence. It is the shape of every failure that
|
|
387
|
+
* happens *after* `authStart` acknowledged the browser step — the state stays
|
|
388
|
+
* `not_authenticated` (there is no "failed" state on the wire), so the reason is
|
|
389
|
+
* the only signal there is.
|
|
390
|
+
*/
|
|
391
|
+
export type WaitForAuthOutcome = {
|
|
392
|
+
state: "authenticated";
|
|
393
|
+
} | {
|
|
394
|
+
state: "error";
|
|
395
|
+
error: string;
|
|
396
|
+
} | {
|
|
397
|
+
state: "timeout";
|
|
398
|
+
};
|
|
366
399
|
export declare class ConnectorClient {
|
|
367
400
|
private readonly transport;
|
|
368
401
|
constructor(transport: Transport);
|
|
@@ -386,13 +419,86 @@ export declare class ConnectorClient {
|
|
|
386
419
|
* the last segment of its wire method.
|
|
387
420
|
*/
|
|
388
421
|
test(connectorId: string): Promise<ConnectorProbeResult>;
|
|
389
|
-
/**
|
|
422
|
+
/**
|
|
423
|
+
* Check the current OAuth state for a connector.
|
|
424
|
+
*
|
|
425
|
+
* Read `error` too: a flow that failed after the browser step is reported as
|
|
426
|
+
* `state: "not_authenticated"` **plus** `error`, because the wire has no
|
|
427
|
+
* failing state to flip to. {@link waitForAuth} is the loop that does this.
|
|
428
|
+
*/
|
|
390
429
|
authStatus(connectorId: string): Promise<OAuthStatusView>;
|
|
430
|
+
/**
|
|
431
|
+
* The credential form a connector needs filled in, as **this caller** sees it
|
|
432
|
+
* (doc `34` §6.1).
|
|
433
|
+
*
|
|
434
|
+
* `mode` says which kind of authentication applies (`none` / `oauth` / `token`),
|
|
435
|
+
* `status` whether anything is still missing, and `missing` names the keys.
|
|
436
|
+
* `fields` is everything needed to render the form — labels, placeholders,
|
|
437
|
+
* descriptions and the marketplace's "where do I get a key" link, in both
|
|
438
|
+
* languages. No secret ever comes back: only `plain` fields carry a `value`.
|
|
439
|
+
*/
|
|
440
|
+
credentials(connectorId: string): Promise<ConnectorCredential>;
|
|
441
|
+
/**
|
|
442
|
+
* Store what the user typed and get the new state back.
|
|
443
|
+
*
|
|
444
|
+
* Only keys the connector's own declaration names are accepted — the form is
|
|
445
|
+
* the whole write surface. `secret` fields go to the host's credential store
|
|
446
|
+
* under the caller's own namespace, `plain` fields into the connector's
|
|
447
|
+
* configuration, so a shared host never resolves one user's token for another.
|
|
448
|
+
*/
|
|
449
|
+
setCredentials(connectorId: string, values: Record<string, string>): Promise<ConnectorCredential>;
|
|
450
|
+
/**
|
|
451
|
+
* Forget stored credentials. `keys` omitted = every secret field of this
|
|
452
|
+
* connector. Idempotent: clearing what is not there succeeds.
|
|
453
|
+
*/
|
|
454
|
+
clearCredentials(connectorId: string, keys?: string[]): Promise<ConnectorCredential>;
|
|
455
|
+
/**
|
|
456
|
+
* Register a connector this host never imported — your own MCP server, handed
|
|
457
|
+
* over together with the template that says what it needs (doc `34` §6.5).
|
|
458
|
+
*
|
|
459
|
+
* The **template is the whole declaration**: whatever `${secret:NAME}` the URL,
|
|
460
|
+
* headers or env name becomes that connector's credential form, so there is no
|
|
461
|
+
* `token-schema.json` to ship and nothing to install from a marketplace. The
|
|
462
|
+
* connector's own non-secret settings travel in `values`.
|
|
463
|
+
*
|
|
464
|
+
* Secrets do **not** travel here: hand them over with {@link setCredentials},
|
|
465
|
+
* which keeps exactly one write surface for values. The returned detail already
|
|
466
|
+
* carries the credential block, so `missing` tells you which keys are still
|
|
467
|
+
* needed.
|
|
468
|
+
*
|
|
469
|
+
* Re-registering the same name updates it; a builtin server's name is refused.
|
|
470
|
+
* The row is created **disabled** — enabling it still requires a probe that
|
|
471
|
+
* passes — and this method is on the installation-owner-only surface, because
|
|
472
|
+
* choosing where the host reaches is the owner's call.
|
|
473
|
+
*/
|
|
474
|
+
register(registration: ConnectorRegistration): Promise<ConnectorDetail>;
|
|
391
475
|
/**
|
|
392
476
|
* Kick off the OAuth browser flow on the trusted host. Returns the start
|
|
393
|
-
* acknowledgement immediately;
|
|
477
|
+
* acknowledgement immediately; follow it with {@link waitForAuth}.
|
|
478
|
+
*
|
|
479
|
+
* `state: "error"` here is a failure that happened **before** the browser was
|
|
480
|
+
* opened (endpoint discovery, client identity, binding the callback, launching
|
|
481
|
+
* the browser): nothing was shown to the user, so `error` is the whole story
|
|
482
|
+
* and there is nothing to wait for.
|
|
394
483
|
*/
|
|
395
484
|
authStart(connectorId: string): Promise<OAuthStartResult>;
|
|
485
|
+
/**
|
|
486
|
+
* Wait for an authorization that was started (in the browser, or by a
|
|
487
|
+
* previous `authStart`) to finish — and **report why** when it does not.
|
|
488
|
+
*
|
|
489
|
+
* A hand-rolled `while (state !== "authenticated") poll()` loop ends in "it
|
|
490
|
+
* never became authenticated", with the reason sitting unread in the status it
|
|
491
|
+
* already fetched: a token exchange the authorization server refused (a
|
|
492
|
+
* throttling gateway answers `slow_down`), a callback timeout, a CSRF/path
|
|
493
|
+
* mismatch. Those land in `authStatus().error` *only*, and the state stays
|
|
494
|
+
* `not_authenticated` — there is no failing state on the wire.
|
|
495
|
+
*
|
|
496
|
+
* Resolves for every domain outcome (`authenticated` / `error` / `timeout`);
|
|
497
|
+
* rejects only when the status read itself fails (transport or protocol), the
|
|
498
|
+
* same rule as `connector/call`. The wait is bounded by `timeoutMs`; a caller
|
|
499
|
+
* that needs to stop earlier can race the returned promise.
|
|
500
|
+
*/
|
|
501
|
+
waitForAuth(connectorId: string, options?: WaitForAuthOptions): Promise<WaitForAuthOutcome>;
|
|
396
502
|
/** Revoke the OAuth token for a connector. */
|
|
397
503
|
logout(connectorId: string): Promise<void>;
|
|
398
504
|
/**
|
|
@@ -610,6 +716,20 @@ export interface StoreClientOptions {
|
|
|
610
716
|
/** First readiness poll interval in ms; doubles up to `readyPollMaxMs`. */
|
|
611
717
|
readyPollMs?: number;
|
|
612
718
|
readyPollMaxMs?: number;
|
|
719
|
+
/**
|
|
720
|
+
* Minimum gap between two *real probes* of the same connector while waiting
|
|
721
|
+
* for readiness, in ms. Defaults to `DEFAULT_READY_PROBE_MS`.
|
|
722
|
+
*
|
|
723
|
+
* A connector's readiness cannot be read: the status is derived from the last
|
|
724
|
+
* probe, so someone has to run one — but a probe is a real connection
|
|
725
|
+
* (`initialize` + `tools/list`) that also resolves the stored token, which
|
|
726
|
+
* means a refresh request when that token is near expiry, plus one more on a
|
|
727
|
+
* 401. Probing once per poll (the poll starts at `readyPollMs` = 400ms) turned
|
|
728
|
+
* a 30s readiness budget into ~10 connections and up to ~20 token requests
|
|
729
|
+
* against the connector's authorization server — with nobody having asked for
|
|
730
|
+
* anything. Between probes the loop reads the (free, local) status instead.
|
|
731
|
+
*/
|
|
732
|
+
readyProbeMs?: number;
|
|
613
733
|
}
|
|
614
734
|
export interface StoreOperationOutcome {
|
|
615
735
|
/** The snapshot the operation acted on; `null` when nothing was imported. */
|
|
@@ -623,6 +743,18 @@ export interface StoreOperationOutcome {
|
|
|
623
743
|
components: InstallOutcome[];
|
|
624
744
|
/** Every reported component reached the requested state. */
|
|
625
745
|
ok: boolean;
|
|
746
|
+
/**
|
|
747
|
+
* The server's own failure lines, verbatim.
|
|
748
|
+
*
|
|
749
|
+
* `ok: false` alone is not an answer: the host explains *why* (a digest
|
|
750
|
+
* conflict means the market changed content without raising the version; a
|
|
751
|
+
* `preset_update_failed` names the component). Dropping these is what made a
|
|
752
|
+
* refused import unexplainable in the UI (`18` §11 D10), so they are carried
|
|
753
|
+
* rather than folded into `ok`.
|
|
754
|
+
*/
|
|
755
|
+
errors: string[];
|
|
756
|
+
/** The server's non-fatal notes, verbatim (e.g. a component left disabled). */
|
|
757
|
+
warnings: string[];
|
|
626
758
|
/**
|
|
627
759
|
* `undefined` when readiness was not checked. `true` when every component is
|
|
628
760
|
* usable now; `false` when it is not (see `readyIssue`).
|
|
@@ -631,6 +763,16 @@ export interface StoreOperationOutcome {
|
|
|
631
763
|
readyIssue?: StoreReadyIssue;
|
|
632
764
|
/** The component that needs attention, when `readyIssue` is set. */
|
|
633
765
|
readyComponentId?: string;
|
|
766
|
+
/** `update()` only: the version that was installed before this call. */
|
|
767
|
+
fromVersion?: string;
|
|
768
|
+
/** `update()` only: the version now installed. */
|
|
769
|
+
toVersion?: string;
|
|
770
|
+
/**
|
|
771
|
+
* `update()` only: how many components of the replaced snapshot were actually
|
|
772
|
+
* released. `0` means the previous installation was not touched — an update
|
|
773
|
+
* that failed, or a no-op.
|
|
774
|
+
*/
|
|
775
|
+
releasedCount?: number;
|
|
634
776
|
}
|
|
635
777
|
/**
|
|
636
778
|
* The slice of `AppServerClient` this layer orchestrates.
|
|
@@ -642,6 +784,7 @@ export interface StoreOperationOutcome {
|
|
|
642
784
|
export interface StoreHost {
|
|
643
785
|
listStore(): Promise<StoreList>;
|
|
644
786
|
installStoreEntry(marketplaceId: string, entryName: string): Promise<StoreInstallResult>;
|
|
787
|
+
updateStoreEntry(marketplaceId: string, entryName: string): Promise<StoreInstallResult>;
|
|
645
788
|
getInstallStatus(snapshotId: string): Promise<InstallStatus>;
|
|
646
789
|
disableInstall(snapshotId: string, componentIds: string[]): Promise<InstallStatus>;
|
|
647
790
|
enableInstall(snapshotId: string, componentIds: string[]): Promise<InstallStatus>;
|
|
@@ -665,6 +808,7 @@ export declare class StoreClient {
|
|
|
665
808
|
private readonly readyTimeoutMs;
|
|
666
809
|
private readonly readyPollMs;
|
|
667
810
|
private readonly readyPollMaxMs;
|
|
811
|
+
private readonly readyProbeMs;
|
|
668
812
|
constructor(host: StoreHost, options?: StoreClientOptions);
|
|
669
813
|
/** Every item across enabled marketplaces, with install state. */
|
|
670
814
|
list(): Promise<StoreItem[]>;
|
|
@@ -685,13 +829,25 @@ export declare class StoreClient {
|
|
|
685
829
|
/**
|
|
686
830
|
* What a caller can offer for an item's pending update.
|
|
687
831
|
*
|
|
688
|
-
* `"none"` means there is nothing to do; `"
|
|
689
|
-
*
|
|
690
|
-
*
|
|
691
|
-
*
|
|
692
|
-
|
|
832
|
+
* `"none"` means there is nothing to do; `"update"` means the entry is
|
|
833
|
+
* installed at a different version and `update()` is the action that lands it
|
|
834
|
+
* (`store/update-entry`, `36` D3); `"unknown"` is returned rather than
|
|
835
|
+
* guessing when the item carries no snapshot to replace.
|
|
836
|
+
*/
|
|
837
|
+
updateHint(item: StoreItem): "none" | "update" | "unknown";
|
|
838
|
+
/**
|
|
839
|
+
* Upgrade an installed item to the version its marketplace advertises.
|
|
840
|
+
*
|
|
841
|
+
* The host does the ordering: new version installed first, previous one
|
|
842
|
+
* released only when that succeeded. So a failure resolves `ok: false` with
|
|
843
|
+
* the previous installation still in place (`releasedCount === 0`) — the
|
|
844
|
+
* caller never has to reason about a half-upgraded item.
|
|
845
|
+
*
|
|
846
|
+
* Refuses before the round trip when there is nothing to replace: an item that
|
|
847
|
+
* is not installed (`not_installed`) or is already current is not a failure of
|
|
848
|
+
* *this* call, and `updateHint()` is the way to ask first.
|
|
693
849
|
*/
|
|
694
|
-
|
|
850
|
+
update(item: StoreItem, options?: InstallOptions): Promise<StoreOperationOutcome>;
|
|
695
851
|
/**
|
|
696
852
|
* Import (when needed) and install one store item, then wait until it is
|
|
697
853
|
* usable.
|
|
@@ -733,6 +889,10 @@ export declare class StoreClient {
|
|
|
733
889
|
* unknown kind is reported ready rather than blocking: this layer cannot judge
|
|
734
890
|
* a component it does not understand, and a false timeout on a future kind
|
|
735
891
|
* would be worse than passing it through.
|
|
892
|
+
*
|
|
893
|
+
* `allowProbe` gates the one kind whose readiness needs a real connection (a
|
|
894
|
+
* connector); the other kinds answer from local reads, so the cadence does not
|
|
895
|
+
* apply to them.
|
|
736
896
|
*/
|
|
737
897
|
private readiness;
|
|
738
898
|
}
|
|
@@ -745,6 +905,16 @@ export declare class TeamClient {
|
|
|
745
905
|
list(): Promise<TeamSummary[]>;
|
|
746
906
|
/** Fetch one TeamDefinition; planning-context bodies are never returned. */
|
|
747
907
|
get(teamId: string): Promise<TeamDetail>;
|
|
908
|
+
/**
|
|
909
|
+
* Export one TeamDefinition as a portable {@link ExpertPack}, with every member
|
|
910
|
+
* expanded and the **leader first**.
|
|
911
|
+
*
|
|
912
|
+
* All-or-nothing: if any member is uninstalled, disabled, or refused by the
|
|
913
|
+
* host's `[expert_export]` table, the whole call fails rather than returning a
|
|
914
|
+
* partial roster — the same posture `team/run` takes before it creates
|
|
915
|
+
* anything. `teamVersion` is an optional pin; a mismatch is `version_mismatch`.
|
|
916
|
+
*/
|
|
917
|
+
export(teamId: string, teamVersion?: string): Promise<ExpertPack>;
|
|
748
918
|
}
|
|
749
919
|
//#endregion
|
|
750
920
|
//#region src/models.d.ts
|
|
@@ -869,6 +1039,15 @@ export declare class AppServerClient {
|
|
|
869
1039
|
listStore(): Promise<StoreList>;
|
|
870
1040
|
/** One-click install: import (when missing) + register in one call. */
|
|
871
1041
|
installStoreEntry(marketplaceId: string, entryName: string): Promise<StoreInstallResult>;
|
|
1042
|
+
/**
|
|
1043
|
+
* Upgrade an installed entry to the version its marketplace advertises.
|
|
1044
|
+
*
|
|
1045
|
+
* The host installs the new version before releasing the old one, so a failure
|
|
1046
|
+
* leaves the previous installation usable (`released_count: 0` is the machine
|
|
1047
|
+
* readable form of that). Refused for an entry that is not installed — this is
|
|
1048
|
+
* never a second way to install something.
|
|
1049
|
+
*/
|
|
1050
|
+
updateStoreEntry(marketplaceId: string, entryName: string): Promise<StoreInstallResult>;
|
|
872
1051
|
}
|
|
873
1052
|
//#endregion
|
|
874
1053
|
//#region src/conversation-handle.d.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentDetail, AgentRunInput, AgentSummary, AnswerDecisionInput, CancelRunInput, ClientCapabilities, ClientInfo, ConnectorCallResult, ConnectorDetail, ConnectorProbeResult, ConnectorStatusView, ConnectorSummary, ContextUsage, ConversationCreateInput, ConversationEvent, ConversationMessage, ConversationMessagesPage, ConversationMessagesQuery, ConversationModelOptions, ConversationSendReceipt, ConversationUpdateInput, ConversationView, ImportDetail, ImportRequest, ImportResult, ImportSummary, InitializeResult, InstallOutcome, InstallRequest, InstallResult, InstallStatus, MarketplaceAddRequest, MarketplaceDetail, MarketplaceRefreshResult, MarketplaceRemoveResult, MarketplaceSummary, MentionRef, ModelSummary, OAuthStartResult, OAuthStatusView, ProviderWithModel, RunEvent, RunEventsQuery, RunPlan, RunReceipt, RunResult, RunStatus, RunView, ServerNotification, SkillDetail, SkillFileContent, SkillFileList, SkillSummary, SteerRunInput, StoreInstallResult, StoreItem, StoreItemKind, StoreList, TeamDetail, TeamRunInput, TeamRunReceipt, TeamSummary, WorkspaceRevokeResult, WorkspaceView } from "@flowy-agent-store/protocol";
|
|
1
|
+
import { AgentDetail, AgentRunInput, AgentSummary, AnswerDecisionInput, CancelRunInput, ClientCapabilities, ClientInfo, ConnectorCallResult, ConnectorCredential, ConnectorDetail, ConnectorProbeResult, ConnectorRegistration, ConnectorStatusView, ConnectorSummary, ContextUsage, ConversationCreateInput, ConversationEvent, ConversationMessage, ConversationMessagesPage, ConversationMessagesQuery, ConversationModelOptions, ConversationSendReceipt, ConversationUpdateInput, ConversationView, ExpertPack, ImportDetail, ImportRequest, ImportResult, ImportSummary, InitializeResult, InstallOutcome, InstallRequest, InstallResult, InstallStatus, MarketplaceAddRequest, MarketplaceDetail, MarketplaceRefreshResult, MarketplaceRemoveResult, MarketplaceSummary, MentionRef, ModelSummary, OAuthStartResult, OAuthStatusView, ProviderWithModel, RunEvent, RunEventsQuery, RunPlan, RunReceipt, RunResult, RunStatus, RunView, ServerNotification, SkillDetail, SkillFileContent, SkillFileList, SkillSummary, SteerRunInput, StoreInstallResult, StoreItem, StoreItemKind, StoreList, TeamDetail, TeamRunInput, TeamRunReceipt, TeamSummary, WorkspaceRevokeResult, WorkspaceView } from "@flowy-agent-store/protocol";
|
|
2
2
|
//#region src/transport.d.ts
|
|
3
3
|
export type NotificationListener = (notification: ServerNotification) => void;
|
|
4
4
|
/**
|
|
@@ -193,6 +193,17 @@ export declare class AgentClient {
|
|
|
193
193
|
list(): Promise<AgentSummary[]>;
|
|
194
194
|
/** Fetch one AgentDefinition; raw prompts never cross the wire. */
|
|
195
195
|
get(agentId: string): Promise<AgentDetail>;
|
|
196
|
+
/**
|
|
197
|
+
* Export one AgentDefinition as a portable {@link ExpertPack}.
|
|
198
|
+
*
|
|
199
|
+
* Requires WebSocket: like the rest of this family, `agent/export` has no HTTP
|
|
200
|
+
* route. The expert must be installed and enabled, or the host answers
|
|
201
|
+
* `agent_not_installed` / `agent_disabled`; a host whose `[expert_export]`
|
|
202
|
+
* table refuses the id answers `policy_denied`. Check
|
|
203
|
+
* `capabilities.expert_export` for the *seam* — it does not promise this id is
|
|
204
|
+
* exportable.
|
|
205
|
+
*/
|
|
206
|
+
export(agentId: string): Promise<ExpertPack>;
|
|
196
207
|
}
|
|
197
208
|
//#endregion
|
|
198
209
|
//#region src/conversations.d.ts
|
|
@@ -363,6 +374,28 @@ export declare class ConversationSubscription {
|
|
|
363
374
|
}
|
|
364
375
|
//#endregion
|
|
365
376
|
//#region src/connectors.d.ts
|
|
377
|
+
export interface WaitForAuthOptions {
|
|
378
|
+
/** Overall budget in ms; defaults to `DEFAULT_AUTH_TIMEOUT_MS` (120s). */
|
|
379
|
+
timeoutMs?: number;
|
|
380
|
+
/** Poll interval in ms; defaults to 500. The read is a local DB projection. */
|
|
381
|
+
pollMs?: number;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* How a completed wait ended.
|
|
385
|
+
*
|
|
386
|
+
* `error` carries the host's own sentence. It is the shape of every failure that
|
|
387
|
+
* happens *after* `authStart` acknowledged the browser step — the state stays
|
|
388
|
+
* `not_authenticated` (there is no "failed" state on the wire), so the reason is
|
|
389
|
+
* the only signal there is.
|
|
390
|
+
*/
|
|
391
|
+
export type WaitForAuthOutcome = {
|
|
392
|
+
state: "authenticated";
|
|
393
|
+
} | {
|
|
394
|
+
state: "error";
|
|
395
|
+
error: string;
|
|
396
|
+
} | {
|
|
397
|
+
state: "timeout";
|
|
398
|
+
};
|
|
366
399
|
export declare class ConnectorClient {
|
|
367
400
|
private readonly transport;
|
|
368
401
|
constructor(transport: Transport);
|
|
@@ -386,13 +419,86 @@ export declare class ConnectorClient {
|
|
|
386
419
|
* the last segment of its wire method.
|
|
387
420
|
*/
|
|
388
421
|
test(connectorId: string): Promise<ConnectorProbeResult>;
|
|
389
|
-
/**
|
|
422
|
+
/**
|
|
423
|
+
* Check the current OAuth state for a connector.
|
|
424
|
+
*
|
|
425
|
+
* Read `error` too: a flow that failed after the browser step is reported as
|
|
426
|
+
* `state: "not_authenticated"` **plus** `error`, because the wire has no
|
|
427
|
+
* failing state to flip to. {@link waitForAuth} is the loop that does this.
|
|
428
|
+
*/
|
|
390
429
|
authStatus(connectorId: string): Promise<OAuthStatusView>;
|
|
430
|
+
/**
|
|
431
|
+
* The credential form a connector needs filled in, as **this caller** sees it
|
|
432
|
+
* (doc `34` §6.1).
|
|
433
|
+
*
|
|
434
|
+
* `mode` says which kind of authentication applies (`none` / `oauth` / `token`),
|
|
435
|
+
* `status` whether anything is still missing, and `missing` names the keys.
|
|
436
|
+
* `fields` is everything needed to render the form — labels, placeholders,
|
|
437
|
+
* descriptions and the marketplace's "where do I get a key" link, in both
|
|
438
|
+
* languages. No secret ever comes back: only `plain` fields carry a `value`.
|
|
439
|
+
*/
|
|
440
|
+
credentials(connectorId: string): Promise<ConnectorCredential>;
|
|
441
|
+
/**
|
|
442
|
+
* Store what the user typed and get the new state back.
|
|
443
|
+
*
|
|
444
|
+
* Only keys the connector's own declaration names are accepted — the form is
|
|
445
|
+
* the whole write surface. `secret` fields go to the host's credential store
|
|
446
|
+
* under the caller's own namespace, `plain` fields into the connector's
|
|
447
|
+
* configuration, so a shared host never resolves one user's token for another.
|
|
448
|
+
*/
|
|
449
|
+
setCredentials(connectorId: string, values: Record<string, string>): Promise<ConnectorCredential>;
|
|
450
|
+
/**
|
|
451
|
+
* Forget stored credentials. `keys` omitted = every secret field of this
|
|
452
|
+
* connector. Idempotent: clearing what is not there succeeds.
|
|
453
|
+
*/
|
|
454
|
+
clearCredentials(connectorId: string, keys?: string[]): Promise<ConnectorCredential>;
|
|
455
|
+
/**
|
|
456
|
+
* Register a connector this host never imported — your own MCP server, handed
|
|
457
|
+
* over together with the template that says what it needs (doc `34` §6.5).
|
|
458
|
+
*
|
|
459
|
+
* The **template is the whole declaration**: whatever `${secret:NAME}` the URL,
|
|
460
|
+
* headers or env name becomes that connector's credential form, so there is no
|
|
461
|
+
* `token-schema.json` to ship and nothing to install from a marketplace. The
|
|
462
|
+
* connector's own non-secret settings travel in `values`.
|
|
463
|
+
*
|
|
464
|
+
* Secrets do **not** travel here: hand them over with {@link setCredentials},
|
|
465
|
+
* which keeps exactly one write surface for values. The returned detail already
|
|
466
|
+
* carries the credential block, so `missing` tells you which keys are still
|
|
467
|
+
* needed.
|
|
468
|
+
*
|
|
469
|
+
* Re-registering the same name updates it; a builtin server's name is refused.
|
|
470
|
+
* The row is created **disabled** — enabling it still requires a probe that
|
|
471
|
+
* passes — and this method is on the installation-owner-only surface, because
|
|
472
|
+
* choosing where the host reaches is the owner's call.
|
|
473
|
+
*/
|
|
474
|
+
register(registration: ConnectorRegistration): Promise<ConnectorDetail>;
|
|
391
475
|
/**
|
|
392
476
|
* Kick off the OAuth browser flow on the trusted host. Returns the start
|
|
393
|
-
* acknowledgement immediately;
|
|
477
|
+
* acknowledgement immediately; follow it with {@link waitForAuth}.
|
|
478
|
+
*
|
|
479
|
+
* `state: "error"` here is a failure that happened **before** the browser was
|
|
480
|
+
* opened (endpoint discovery, client identity, binding the callback, launching
|
|
481
|
+
* the browser): nothing was shown to the user, so `error` is the whole story
|
|
482
|
+
* and there is nothing to wait for.
|
|
394
483
|
*/
|
|
395
484
|
authStart(connectorId: string): Promise<OAuthStartResult>;
|
|
485
|
+
/**
|
|
486
|
+
* Wait for an authorization that was started (in the browser, or by a
|
|
487
|
+
* previous `authStart`) to finish — and **report why** when it does not.
|
|
488
|
+
*
|
|
489
|
+
* A hand-rolled `while (state !== "authenticated") poll()` loop ends in "it
|
|
490
|
+
* never became authenticated", with the reason sitting unread in the status it
|
|
491
|
+
* already fetched: a token exchange the authorization server refused (a
|
|
492
|
+
* throttling gateway answers `slow_down`), a callback timeout, a CSRF/path
|
|
493
|
+
* mismatch. Those land in `authStatus().error` *only*, and the state stays
|
|
494
|
+
* `not_authenticated` — there is no failing state on the wire.
|
|
495
|
+
*
|
|
496
|
+
* Resolves for every domain outcome (`authenticated` / `error` / `timeout`);
|
|
497
|
+
* rejects only when the status read itself fails (transport or protocol), the
|
|
498
|
+
* same rule as `connector/call`. The wait is bounded by `timeoutMs`; a caller
|
|
499
|
+
* that needs to stop earlier can race the returned promise.
|
|
500
|
+
*/
|
|
501
|
+
waitForAuth(connectorId: string, options?: WaitForAuthOptions): Promise<WaitForAuthOutcome>;
|
|
396
502
|
/** Revoke the OAuth token for a connector. */
|
|
397
503
|
logout(connectorId: string): Promise<void>;
|
|
398
504
|
/**
|
|
@@ -610,6 +716,20 @@ export interface StoreClientOptions {
|
|
|
610
716
|
/** First readiness poll interval in ms; doubles up to `readyPollMaxMs`. */
|
|
611
717
|
readyPollMs?: number;
|
|
612
718
|
readyPollMaxMs?: number;
|
|
719
|
+
/**
|
|
720
|
+
* Minimum gap between two *real probes* of the same connector while waiting
|
|
721
|
+
* for readiness, in ms. Defaults to `DEFAULT_READY_PROBE_MS`.
|
|
722
|
+
*
|
|
723
|
+
* A connector's readiness cannot be read: the status is derived from the last
|
|
724
|
+
* probe, so someone has to run one — but a probe is a real connection
|
|
725
|
+
* (`initialize` + `tools/list`) that also resolves the stored token, which
|
|
726
|
+
* means a refresh request when that token is near expiry, plus one more on a
|
|
727
|
+
* 401. Probing once per poll (the poll starts at `readyPollMs` = 400ms) turned
|
|
728
|
+
* a 30s readiness budget into ~10 connections and up to ~20 token requests
|
|
729
|
+
* against the connector's authorization server — with nobody having asked for
|
|
730
|
+
* anything. Between probes the loop reads the (free, local) status instead.
|
|
731
|
+
*/
|
|
732
|
+
readyProbeMs?: number;
|
|
613
733
|
}
|
|
614
734
|
export interface StoreOperationOutcome {
|
|
615
735
|
/** The snapshot the operation acted on; `null` when nothing was imported. */
|
|
@@ -623,6 +743,18 @@ export interface StoreOperationOutcome {
|
|
|
623
743
|
components: InstallOutcome[];
|
|
624
744
|
/** Every reported component reached the requested state. */
|
|
625
745
|
ok: boolean;
|
|
746
|
+
/**
|
|
747
|
+
* The server's own failure lines, verbatim.
|
|
748
|
+
*
|
|
749
|
+
* `ok: false` alone is not an answer: the host explains *why* (a digest
|
|
750
|
+
* conflict means the market changed content without raising the version; a
|
|
751
|
+
* `preset_update_failed` names the component). Dropping these is what made a
|
|
752
|
+
* refused import unexplainable in the UI (`18` §11 D10), so they are carried
|
|
753
|
+
* rather than folded into `ok`.
|
|
754
|
+
*/
|
|
755
|
+
errors: string[];
|
|
756
|
+
/** The server's non-fatal notes, verbatim (e.g. a component left disabled). */
|
|
757
|
+
warnings: string[];
|
|
626
758
|
/**
|
|
627
759
|
* `undefined` when readiness was not checked. `true` when every component is
|
|
628
760
|
* usable now; `false` when it is not (see `readyIssue`).
|
|
@@ -631,6 +763,16 @@ export interface StoreOperationOutcome {
|
|
|
631
763
|
readyIssue?: StoreReadyIssue;
|
|
632
764
|
/** The component that needs attention, when `readyIssue` is set. */
|
|
633
765
|
readyComponentId?: string;
|
|
766
|
+
/** `update()` only: the version that was installed before this call. */
|
|
767
|
+
fromVersion?: string;
|
|
768
|
+
/** `update()` only: the version now installed. */
|
|
769
|
+
toVersion?: string;
|
|
770
|
+
/**
|
|
771
|
+
* `update()` only: how many components of the replaced snapshot were actually
|
|
772
|
+
* released. `0` means the previous installation was not touched — an update
|
|
773
|
+
* that failed, or a no-op.
|
|
774
|
+
*/
|
|
775
|
+
releasedCount?: number;
|
|
634
776
|
}
|
|
635
777
|
/**
|
|
636
778
|
* The slice of `AppServerClient` this layer orchestrates.
|
|
@@ -642,6 +784,7 @@ export interface StoreOperationOutcome {
|
|
|
642
784
|
export interface StoreHost {
|
|
643
785
|
listStore(): Promise<StoreList>;
|
|
644
786
|
installStoreEntry(marketplaceId: string, entryName: string): Promise<StoreInstallResult>;
|
|
787
|
+
updateStoreEntry(marketplaceId: string, entryName: string): Promise<StoreInstallResult>;
|
|
645
788
|
getInstallStatus(snapshotId: string): Promise<InstallStatus>;
|
|
646
789
|
disableInstall(snapshotId: string, componentIds: string[]): Promise<InstallStatus>;
|
|
647
790
|
enableInstall(snapshotId: string, componentIds: string[]): Promise<InstallStatus>;
|
|
@@ -665,6 +808,7 @@ export declare class StoreClient {
|
|
|
665
808
|
private readonly readyTimeoutMs;
|
|
666
809
|
private readonly readyPollMs;
|
|
667
810
|
private readonly readyPollMaxMs;
|
|
811
|
+
private readonly readyProbeMs;
|
|
668
812
|
constructor(host: StoreHost, options?: StoreClientOptions);
|
|
669
813
|
/** Every item across enabled marketplaces, with install state. */
|
|
670
814
|
list(): Promise<StoreItem[]>;
|
|
@@ -685,13 +829,25 @@ export declare class StoreClient {
|
|
|
685
829
|
/**
|
|
686
830
|
* What a caller can offer for an item's pending update.
|
|
687
831
|
*
|
|
688
|
-
* `"none"` means there is nothing to do; `"
|
|
689
|
-
*
|
|
690
|
-
*
|
|
691
|
-
*
|
|
692
|
-
|
|
832
|
+
* `"none"` means there is nothing to do; `"update"` means the entry is
|
|
833
|
+
* installed at a different version and `update()` is the action that lands it
|
|
834
|
+
* (`store/update-entry`, `36` D3); `"unknown"` is returned rather than
|
|
835
|
+
* guessing when the item carries no snapshot to replace.
|
|
836
|
+
*/
|
|
837
|
+
updateHint(item: StoreItem): "none" | "update" | "unknown";
|
|
838
|
+
/**
|
|
839
|
+
* Upgrade an installed item to the version its marketplace advertises.
|
|
840
|
+
*
|
|
841
|
+
* The host does the ordering: new version installed first, previous one
|
|
842
|
+
* released only when that succeeded. So a failure resolves `ok: false` with
|
|
843
|
+
* the previous installation still in place (`releasedCount === 0`) — the
|
|
844
|
+
* caller never has to reason about a half-upgraded item.
|
|
845
|
+
*
|
|
846
|
+
* Refuses before the round trip when there is nothing to replace: an item that
|
|
847
|
+
* is not installed (`not_installed`) or is already current is not a failure of
|
|
848
|
+
* *this* call, and `updateHint()` is the way to ask first.
|
|
693
849
|
*/
|
|
694
|
-
|
|
850
|
+
update(item: StoreItem, options?: InstallOptions): Promise<StoreOperationOutcome>;
|
|
695
851
|
/**
|
|
696
852
|
* Import (when needed) and install one store item, then wait until it is
|
|
697
853
|
* usable.
|
|
@@ -733,6 +889,10 @@ export declare class StoreClient {
|
|
|
733
889
|
* unknown kind is reported ready rather than blocking: this layer cannot judge
|
|
734
890
|
* a component it does not understand, and a false timeout on a future kind
|
|
735
891
|
* would be worse than passing it through.
|
|
892
|
+
*
|
|
893
|
+
* `allowProbe` gates the one kind whose readiness needs a real connection (a
|
|
894
|
+
* connector); the other kinds answer from local reads, so the cadence does not
|
|
895
|
+
* apply to them.
|
|
736
896
|
*/
|
|
737
897
|
private readiness;
|
|
738
898
|
}
|
|
@@ -745,6 +905,16 @@ export declare class TeamClient {
|
|
|
745
905
|
list(): Promise<TeamSummary[]>;
|
|
746
906
|
/** Fetch one TeamDefinition; planning-context bodies are never returned. */
|
|
747
907
|
get(teamId: string): Promise<TeamDetail>;
|
|
908
|
+
/**
|
|
909
|
+
* Export one TeamDefinition as a portable {@link ExpertPack}, with every member
|
|
910
|
+
* expanded and the **leader first**.
|
|
911
|
+
*
|
|
912
|
+
* All-or-nothing: if any member is uninstalled, disabled, or refused by the
|
|
913
|
+
* host's `[expert_export]` table, the whole call fails rather than returning a
|
|
914
|
+
* partial roster — the same posture `team/run` takes before it creates
|
|
915
|
+
* anything. `teamVersion` is an optional pin; a mismatch is `version_mismatch`.
|
|
916
|
+
*/
|
|
917
|
+
export(teamId: string, teamVersion?: string): Promise<ExpertPack>;
|
|
748
918
|
}
|
|
749
919
|
//#endregion
|
|
750
920
|
//#region src/models.d.ts
|
|
@@ -869,6 +1039,15 @@ export declare class AppServerClient {
|
|
|
869
1039
|
listStore(): Promise<StoreList>;
|
|
870
1040
|
/** One-click install: import (when missing) + register in one call. */
|
|
871
1041
|
installStoreEntry(marketplaceId: string, entryName: string): Promise<StoreInstallResult>;
|
|
1042
|
+
/**
|
|
1043
|
+
* Upgrade an installed entry to the version its marketplace advertises.
|
|
1044
|
+
*
|
|
1045
|
+
* The host installs the new version before releasing the old one, so a failure
|
|
1046
|
+
* leaves the previous installation usable (`released_count: 0` is the machine
|
|
1047
|
+
* readable form of that). Refused for an entry that is not installed — this is
|
|
1048
|
+
* never a second way to install something.
|
|
1049
|
+
*/
|
|
1050
|
+
updateStoreEntry(marketplaceId: string, entryName: string): Promise<StoreInstallResult>;
|
|
872
1051
|
}
|
|
873
1052
|
//#endregion
|
|
874
1053
|
//#region src/conversation-handle.d.ts
|