@qoniai/qoni 0.5.1 → 0.6.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/CHANGELOG.md +17 -0
- package/README.md +10 -2
- package/README.zh-CN.md +6 -2
- package/dist/index.cjs +93 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/index.js +93 -83
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -445,6 +445,8 @@ declare const QoniEventTypes: {
|
|
|
445
445
|
readonly Interaction: "interaction";
|
|
446
446
|
/** A live screenshot frame (opt in with `capture: { screenshots: true }`); image on `event.image`. */
|
|
447
447
|
readonly Screenshot: "screenshot";
|
|
448
|
+
/** The browser viewer moved to a new page or needs a fresh attachment. Use `event.data.liveUrl` for the live preview. */
|
|
449
|
+
readonly BrowserLiveUrlChanged: "browserLiveUrlChanged";
|
|
448
450
|
/** Terminal — the run finished; outcome + output in `event.data` (cost is on the `RunResult`). */
|
|
449
451
|
readonly Done: "done";
|
|
450
452
|
/** Web Search results are ready; `event.data` is the count (the list is in `done.output`). */
|
|
@@ -487,6 +489,13 @@ interface RunScreenshotData {
|
|
|
487
489
|
pageUrl?: string;
|
|
488
490
|
step?: number;
|
|
489
491
|
}
|
|
492
|
+
/** `browserLiveUrlChanged` — the provider's live viewer URL can rotate as tabs change. */
|
|
493
|
+
interface RunBrowserLiveUrlChangedData {
|
|
494
|
+
liveUrl: string;
|
|
495
|
+
supportsLivePump: boolean;
|
|
496
|
+
forceViewerReload: boolean;
|
|
497
|
+
providerSessionId?: string;
|
|
498
|
+
}
|
|
490
499
|
/** `done` — terminal outcome + final output. (Total cost is on the `RunResult`.) */
|
|
491
500
|
interface RunDoneData {
|
|
492
501
|
output?: unknown;
|
|
@@ -510,6 +519,10 @@ type RunEvent = (RunEventBase & {
|
|
|
510
519
|
data: RunScreenshotData;
|
|
511
520
|
image: RunImage;
|
|
512
521
|
isTerminal: false;
|
|
522
|
+
}) | (RunEventBase & {
|
|
523
|
+
type: "browserLiveUrlChanged";
|
|
524
|
+
data: RunBrowserLiveUrlChangedData;
|
|
525
|
+
isTerminal: false;
|
|
513
526
|
}) | (RunEventBase & {
|
|
514
527
|
type: "done";
|
|
515
528
|
data: RunDoneData;
|
|
@@ -541,7 +554,7 @@ type RunEvent = (RunEventBase & {
|
|
|
541
554
|
});
|
|
542
555
|
/** Events any product run can emit. */
|
|
543
556
|
type CoreRunEvent = Extract<RunEvent, {
|
|
544
|
-
type: "progress" | "message" | "interaction" | "screenshot" | "done";
|
|
557
|
+
type: "progress" | "message" | "interaction" | "screenshot" | "browserLiveUrlChanged" | "done";
|
|
545
558
|
}>;
|
|
546
559
|
/** Do Anything — core events only. */
|
|
547
560
|
type DoAnythingEvent = CoreRunEvent;
|
|
@@ -1309,7 +1322,7 @@ declare class Qoni {
|
|
|
1309
1322
|
* while still giving literal autocomplete and letting you write an exhaustive
|
|
1310
1323
|
* `switch (err.code)` over the known set.
|
|
1311
1324
|
*/
|
|
1312
|
-
type QoniErrorCode = "qoni_error" | "auth.failed" | "delegation.required" | "permission_denied" | "token.expired" | "validation.failed" | "rate_limit.exceeded" | "upstream.failed" | "timeout" | "not_found" | "conflict" | "eak.delegation.user_not_bound" | "eak.genauth.userpool_binding_missing" | "eak.genauth.userpool_owner_missing" | "eak.genauth.no_bound_users" | "eak.token_exchange.upstream_failed" | (string & {});
|
|
1325
|
+
type QoniErrorCode = "qoni_error" | "auth.failed" | "delegation.required" | "permission_denied" | "token.expired" | "validation.failed" | "rate_limit.exceeded" | "upstream.failed" | "timeout" | "not_found" | "conflict" | "eak.delegation.user_not_bound" | "eak.delegation.no_allowed_scopes" | "eak.delegation.scope_not_allowed" | "eak.genauth.userpool_binding_missing" | "eak.genauth.userpool_owner_missing" | "eak.genauth.no_bound_users" | "eak.token_exchange.upstream_failed" | (string & {});
|
|
1313
1326
|
interface QoniErrorOptions {
|
|
1314
1327
|
code?: QoniErrorCode;
|
|
1315
1328
|
status?: number;
|
|
@@ -1394,4 +1407,4 @@ declare const QoniScopeBundles: {
|
|
|
1394
1407
|
readonly TRACK: readonly ["webagent.track:read", "webagent.track:manage"];
|
|
1395
1408
|
};
|
|
1396
1409
|
|
|
1397
|
-
export { type Action, type ActionKind, ActionKinds, type Artifact, type BrowserProxyOptions, type BrowserbaseRegion, type CaptureOptions, type ClarificationPayload, type CompleteDelegateAgentInput, type CompleteDelegateTokenInput, type ConfirmationPayload, type CoreRunEvent, type DeepResearchAttachOptions, type DeepResearchEvent, type DeepResearchRunOptions, type DelegateAgentInput, type DelegateAgentResponse, type DelegateAgentTokenResponse, type DelegateTokenInput, type DelegateTokenInteractiveInput, type DelegateTokenResponse, type DelegateTokenResult, type DelegateTokenSilentInput, type DelegateTokenSilentResponse, type DelegationMode, type DelegationTokenResponse, type DoAnythingAttachOptions, type DoAnythingEvent, type DoAnythingRunOptions, type DoAnythingSnapshot, type GenAuthAccessTokenInput, type GenAuthAdminToken, type GenAuthAdminTokenOverrideInput, type GenAuthDelegationIntrospectionInput, type GenAuthUserCreateBatchInput, type GenAuthUserCreateInput, type GenAuthUserDeleteBatchInput, type GenAuthUserGetBatchInput, type GenAuthUserGetInput, type GenAuthUserListInput, type GenAuthUserUpdateInput, type Interaction, type InteractionEvidence, InteractionHandle, type InteractionPayloadByType, type InteractionSite, type InteractionStatus, InteractionStatuses, type InteractionType, InteractionTypes, type InteractiveDelegationResponse, type JsonObject, type MonitorEvent, type MonitorEventsOptions, MonitorHandle, type MonitorRunsOptions, Qoni, QoniAuthError, QoniDelegationRequiredError, QoniError, type QoniErrorCode, type QoniErrorOptions, type QoniEvent, type QoniEventType, QoniEventTypes, type QoniMeta, type QoniOptions, QoniPermissionDeniedError, type QoniProduct, type QoniProductName, QoniProductScopes, QoniRateLimitError, type QoniResponse, type QoniRuntimeConfig, type QoniSSEEvent, QoniScopeBundles, QoniScopes, QoniTimeoutError, QoniTokenExpiredError, QoniUpstreamError, QoniValidationError, type RawRequestInput, type RunDoneData, type RunEvent, type RunEventsOptions, RunHandle, type RunImage, type RunLimits, type RunMessageData, type RunReconnectInfo, type RunResult, type RunScreenshotData, type RunStatus, type RunWaitOptions, type RuntimeTokenInput, type SessionRef, type SiteLoginPayload, type SnapshotAction, type SnapshotImage, type TakeControlPayload, type TokenInput, type TrackAttachOptions, type TrackCreateOptions, type WaitKind, type WaitPayload, type WebSearchAttachOptions, type WebSearchEvent, type WebSearchRunOptions, buildAuthorization, buildSignature, buildStringToSign };
|
|
1410
|
+
export { type Action, type ActionKind, ActionKinds, type Artifact, type BrowserProxyOptions, type BrowserbaseRegion, type CaptureOptions, type ClarificationPayload, type CompleteDelegateAgentInput, type CompleteDelegateTokenInput, type ConfirmationPayload, type CoreRunEvent, type DeepResearchAttachOptions, type DeepResearchEvent, type DeepResearchRunOptions, type DelegateAgentInput, type DelegateAgentResponse, type DelegateAgentTokenResponse, type DelegateTokenInput, type DelegateTokenInteractiveInput, type DelegateTokenResponse, type DelegateTokenResult, type DelegateTokenSilentInput, type DelegateTokenSilentResponse, type DelegationMode, type DelegationTokenResponse, type DoAnythingAttachOptions, type DoAnythingEvent, type DoAnythingRunOptions, type DoAnythingSnapshot, type GenAuthAccessTokenInput, type GenAuthAdminToken, type GenAuthAdminTokenOverrideInput, type GenAuthDelegationIntrospectionInput, type GenAuthUserCreateBatchInput, type GenAuthUserCreateInput, type GenAuthUserDeleteBatchInput, type GenAuthUserGetBatchInput, type GenAuthUserGetInput, type GenAuthUserListInput, type GenAuthUserUpdateInput, type Interaction, type InteractionEvidence, InteractionHandle, type InteractionPayloadByType, type InteractionSite, type InteractionStatus, InteractionStatuses, type InteractionType, InteractionTypes, type InteractiveDelegationResponse, type JsonObject, type MonitorEvent, type MonitorEventsOptions, MonitorHandle, type MonitorRunsOptions, Qoni, QoniAuthError, QoniDelegationRequiredError, QoniError, type QoniErrorCode, type QoniErrorOptions, type QoniEvent, type QoniEventType, QoniEventTypes, type QoniMeta, type QoniOptions, QoniPermissionDeniedError, type QoniProduct, type QoniProductName, QoniProductScopes, QoniRateLimitError, type QoniResponse, type QoniRuntimeConfig, type QoniSSEEvent, QoniScopeBundles, QoniScopes, QoniTimeoutError, QoniTokenExpiredError, QoniUpstreamError, QoniValidationError, type RawRequestInput, type RunBrowserLiveUrlChangedData, type RunDoneData, type RunEvent, type RunEventsOptions, RunHandle, type RunImage, type RunLimits, type RunMessageData, type RunReconnectInfo, type RunResult, type RunScreenshotData, type RunStatus, type RunWaitOptions, type RuntimeTokenInput, type SessionRef, type SiteLoginPayload, type SnapshotAction, type SnapshotImage, type TakeControlPayload, type TokenInput, type TrackAttachOptions, type TrackCreateOptions, type WaitKind, type WaitPayload, type WebSearchAttachOptions, type WebSearchEvent, type WebSearchRunOptions, buildAuthorization, buildSignature, buildStringToSign };
|
package/dist/index.d.ts
CHANGED
|
@@ -445,6 +445,8 @@ declare const QoniEventTypes: {
|
|
|
445
445
|
readonly Interaction: "interaction";
|
|
446
446
|
/** A live screenshot frame (opt in with `capture: { screenshots: true }`); image on `event.image`. */
|
|
447
447
|
readonly Screenshot: "screenshot";
|
|
448
|
+
/** The browser viewer moved to a new page or needs a fresh attachment. Use `event.data.liveUrl` for the live preview. */
|
|
449
|
+
readonly BrowserLiveUrlChanged: "browserLiveUrlChanged";
|
|
448
450
|
/** Terminal — the run finished; outcome + output in `event.data` (cost is on the `RunResult`). */
|
|
449
451
|
readonly Done: "done";
|
|
450
452
|
/** Web Search results are ready; `event.data` is the count (the list is in `done.output`). */
|
|
@@ -487,6 +489,13 @@ interface RunScreenshotData {
|
|
|
487
489
|
pageUrl?: string;
|
|
488
490
|
step?: number;
|
|
489
491
|
}
|
|
492
|
+
/** `browserLiveUrlChanged` — the provider's live viewer URL can rotate as tabs change. */
|
|
493
|
+
interface RunBrowserLiveUrlChangedData {
|
|
494
|
+
liveUrl: string;
|
|
495
|
+
supportsLivePump: boolean;
|
|
496
|
+
forceViewerReload: boolean;
|
|
497
|
+
providerSessionId?: string;
|
|
498
|
+
}
|
|
490
499
|
/** `done` — terminal outcome + final output. (Total cost is on the `RunResult`.) */
|
|
491
500
|
interface RunDoneData {
|
|
492
501
|
output?: unknown;
|
|
@@ -510,6 +519,10 @@ type RunEvent = (RunEventBase & {
|
|
|
510
519
|
data: RunScreenshotData;
|
|
511
520
|
image: RunImage;
|
|
512
521
|
isTerminal: false;
|
|
522
|
+
}) | (RunEventBase & {
|
|
523
|
+
type: "browserLiveUrlChanged";
|
|
524
|
+
data: RunBrowserLiveUrlChangedData;
|
|
525
|
+
isTerminal: false;
|
|
513
526
|
}) | (RunEventBase & {
|
|
514
527
|
type: "done";
|
|
515
528
|
data: RunDoneData;
|
|
@@ -541,7 +554,7 @@ type RunEvent = (RunEventBase & {
|
|
|
541
554
|
});
|
|
542
555
|
/** Events any product run can emit. */
|
|
543
556
|
type CoreRunEvent = Extract<RunEvent, {
|
|
544
|
-
type: "progress" | "message" | "interaction" | "screenshot" | "done";
|
|
557
|
+
type: "progress" | "message" | "interaction" | "screenshot" | "browserLiveUrlChanged" | "done";
|
|
545
558
|
}>;
|
|
546
559
|
/** Do Anything — core events only. */
|
|
547
560
|
type DoAnythingEvent = CoreRunEvent;
|
|
@@ -1309,7 +1322,7 @@ declare class Qoni {
|
|
|
1309
1322
|
* while still giving literal autocomplete and letting you write an exhaustive
|
|
1310
1323
|
* `switch (err.code)` over the known set.
|
|
1311
1324
|
*/
|
|
1312
|
-
type QoniErrorCode = "qoni_error" | "auth.failed" | "delegation.required" | "permission_denied" | "token.expired" | "validation.failed" | "rate_limit.exceeded" | "upstream.failed" | "timeout" | "not_found" | "conflict" | "eak.delegation.user_not_bound" | "eak.genauth.userpool_binding_missing" | "eak.genauth.userpool_owner_missing" | "eak.genauth.no_bound_users" | "eak.token_exchange.upstream_failed" | (string & {});
|
|
1325
|
+
type QoniErrorCode = "qoni_error" | "auth.failed" | "delegation.required" | "permission_denied" | "token.expired" | "validation.failed" | "rate_limit.exceeded" | "upstream.failed" | "timeout" | "not_found" | "conflict" | "eak.delegation.user_not_bound" | "eak.delegation.no_allowed_scopes" | "eak.delegation.scope_not_allowed" | "eak.genauth.userpool_binding_missing" | "eak.genauth.userpool_owner_missing" | "eak.genauth.no_bound_users" | "eak.token_exchange.upstream_failed" | (string & {});
|
|
1313
1326
|
interface QoniErrorOptions {
|
|
1314
1327
|
code?: QoniErrorCode;
|
|
1315
1328
|
status?: number;
|
|
@@ -1394,4 +1407,4 @@ declare const QoniScopeBundles: {
|
|
|
1394
1407
|
readonly TRACK: readonly ["webagent.track:read", "webagent.track:manage"];
|
|
1395
1408
|
};
|
|
1396
1409
|
|
|
1397
|
-
export { type Action, type ActionKind, ActionKinds, type Artifact, type BrowserProxyOptions, type BrowserbaseRegion, type CaptureOptions, type ClarificationPayload, type CompleteDelegateAgentInput, type CompleteDelegateTokenInput, type ConfirmationPayload, type CoreRunEvent, type DeepResearchAttachOptions, type DeepResearchEvent, type DeepResearchRunOptions, type DelegateAgentInput, type DelegateAgentResponse, type DelegateAgentTokenResponse, type DelegateTokenInput, type DelegateTokenInteractiveInput, type DelegateTokenResponse, type DelegateTokenResult, type DelegateTokenSilentInput, type DelegateTokenSilentResponse, type DelegationMode, type DelegationTokenResponse, type DoAnythingAttachOptions, type DoAnythingEvent, type DoAnythingRunOptions, type DoAnythingSnapshot, type GenAuthAccessTokenInput, type GenAuthAdminToken, type GenAuthAdminTokenOverrideInput, type GenAuthDelegationIntrospectionInput, type GenAuthUserCreateBatchInput, type GenAuthUserCreateInput, type GenAuthUserDeleteBatchInput, type GenAuthUserGetBatchInput, type GenAuthUserGetInput, type GenAuthUserListInput, type GenAuthUserUpdateInput, type Interaction, type InteractionEvidence, InteractionHandle, type InteractionPayloadByType, type InteractionSite, type InteractionStatus, InteractionStatuses, type InteractionType, InteractionTypes, type InteractiveDelegationResponse, type JsonObject, type MonitorEvent, type MonitorEventsOptions, MonitorHandle, type MonitorRunsOptions, Qoni, QoniAuthError, QoniDelegationRequiredError, QoniError, type QoniErrorCode, type QoniErrorOptions, type QoniEvent, type QoniEventType, QoniEventTypes, type QoniMeta, type QoniOptions, QoniPermissionDeniedError, type QoniProduct, type QoniProductName, QoniProductScopes, QoniRateLimitError, type QoniResponse, type QoniRuntimeConfig, type QoniSSEEvent, QoniScopeBundles, QoniScopes, QoniTimeoutError, QoniTokenExpiredError, QoniUpstreamError, QoniValidationError, type RawRequestInput, type RunDoneData, type RunEvent, type RunEventsOptions, RunHandle, type RunImage, type RunLimits, type RunMessageData, type RunReconnectInfo, type RunResult, type RunScreenshotData, type RunStatus, type RunWaitOptions, type RuntimeTokenInput, type SessionRef, type SiteLoginPayload, type SnapshotAction, type SnapshotImage, type TakeControlPayload, type TokenInput, type TrackAttachOptions, type TrackCreateOptions, type WaitKind, type WaitPayload, type WebSearchAttachOptions, type WebSearchEvent, type WebSearchRunOptions, buildAuthorization, buildSignature, buildStringToSign };
|
|
1410
|
+
export { type Action, type ActionKind, ActionKinds, type Artifact, type BrowserProxyOptions, type BrowserbaseRegion, type CaptureOptions, type ClarificationPayload, type CompleteDelegateAgentInput, type CompleteDelegateTokenInput, type ConfirmationPayload, type CoreRunEvent, type DeepResearchAttachOptions, type DeepResearchEvent, type DeepResearchRunOptions, type DelegateAgentInput, type DelegateAgentResponse, type DelegateAgentTokenResponse, type DelegateTokenInput, type DelegateTokenInteractiveInput, type DelegateTokenResponse, type DelegateTokenResult, type DelegateTokenSilentInput, type DelegateTokenSilentResponse, type DelegationMode, type DelegationTokenResponse, type DoAnythingAttachOptions, type DoAnythingEvent, type DoAnythingRunOptions, type DoAnythingSnapshot, type GenAuthAccessTokenInput, type GenAuthAdminToken, type GenAuthAdminTokenOverrideInput, type GenAuthDelegationIntrospectionInput, type GenAuthUserCreateBatchInput, type GenAuthUserCreateInput, type GenAuthUserDeleteBatchInput, type GenAuthUserGetBatchInput, type GenAuthUserGetInput, type GenAuthUserListInput, type GenAuthUserUpdateInput, type Interaction, type InteractionEvidence, InteractionHandle, type InteractionPayloadByType, type InteractionSite, type InteractionStatus, InteractionStatuses, type InteractionType, InteractionTypes, type InteractiveDelegationResponse, type JsonObject, type MonitorEvent, type MonitorEventsOptions, MonitorHandle, type MonitorRunsOptions, Qoni, QoniAuthError, QoniDelegationRequiredError, QoniError, type QoniErrorCode, type QoniErrorOptions, type QoniEvent, type QoniEventType, QoniEventTypes, type QoniMeta, type QoniOptions, QoniPermissionDeniedError, type QoniProduct, type QoniProductName, QoniProductScopes, QoniRateLimitError, type QoniResponse, type QoniRuntimeConfig, type QoniSSEEvent, QoniScopeBundles, QoniScopes, QoniTimeoutError, QoniTokenExpiredError, QoniUpstreamError, QoniValidationError, type RawRequestInput, type RunBrowserLiveUrlChangedData, type RunDoneData, type RunEvent, type RunEventsOptions, RunHandle, type RunImage, type RunLimits, type RunMessageData, type RunReconnectInfo, type RunResult, type RunScreenshotData, type RunStatus, type RunWaitOptions, type RuntimeTokenInput, type SessionRef, type SiteLoginPayload, type SnapshotAction, type SnapshotImage, type TakeControlPayload, type TokenInput, type TrackAttachOptions, type TrackCreateOptions, type WaitKind, type WaitPayload, type WebSearchAttachOptions, type WebSearchEvent, type WebSearchRunOptions, buildAuthorization, buildSignature, buildStringToSign };
|
package/dist/index.js
CHANGED
|
@@ -56,81 +56,6 @@ function buildSignedHeaders(credentials, method, pathname, payload) {
|
|
|
56
56
|
return headers;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
// src/scopes.ts
|
|
60
|
-
var QoniScopes = {
|
|
61
|
-
GUMEM_SESSION_CREATE: "gumem.session:create",
|
|
62
|
-
GUMEM_MESSAGE_WRITE: "gumem.message:write",
|
|
63
|
-
GUMEM_MEMORY_READ: "gumem.memory:read",
|
|
64
|
-
GUMEM_MEMORY_WRITE: "gumem.memory:write",
|
|
65
|
-
GUMEM_MEMORY_DELETE: "gumem.memory:delete",
|
|
66
|
-
GUMEM_SEARCH_RUN: "gumem.search:run",
|
|
67
|
-
GUMEM_ADMIN_MANAGE: "gumem.admin:manage",
|
|
68
|
-
GUMEM_RESOURCE_WRITE: "gumem.resource:write",
|
|
69
|
-
GUMEM_ACTION_WRITE: "gumem.action:write",
|
|
70
|
-
GUMEM_ACTION_READ: "gumem.action:read",
|
|
71
|
-
GUMEM_PROFILE_READ: "gumem.profile:read",
|
|
72
|
-
// WebAgent products: exactly two verbs per product — `read` (observe) and
|
|
73
|
-
// `manage` (anything that changes execution state). See
|
|
74
|
-
// wa/docs/qoni-sdk-public-surface.md §3.
|
|
75
|
-
DO_ANYTHING_READ: "webagent.do_anything:read",
|
|
76
|
-
DO_ANYTHING_MANAGE: "webagent.do_anything:manage",
|
|
77
|
-
WEB_SEARCH_READ: "webagent.web_search:read",
|
|
78
|
-
WEB_SEARCH_MANAGE: "webagent.web_search:manage",
|
|
79
|
-
DEEP_RESEARCH_READ: "webagent.deep_research:read",
|
|
80
|
-
DEEP_RESEARCH_MANAGE: "webagent.deep_research:manage",
|
|
81
|
-
TRACK_READ: "webagent.track:read",
|
|
82
|
-
TRACK_MANAGE: "webagent.track:manage"
|
|
83
|
-
};
|
|
84
|
-
var QoniProductScopes = {
|
|
85
|
-
doAnything: [
|
|
86
|
-
QoniScopes.DO_ANYTHING_READ,
|
|
87
|
-
QoniScopes.DO_ANYTHING_MANAGE
|
|
88
|
-
],
|
|
89
|
-
webSearch: [
|
|
90
|
-
QoniScopes.WEB_SEARCH_READ,
|
|
91
|
-
QoniScopes.WEB_SEARCH_MANAGE
|
|
92
|
-
],
|
|
93
|
-
deepResearch: [
|
|
94
|
-
QoniScopes.DEEP_RESEARCH_READ,
|
|
95
|
-
QoniScopes.DEEP_RESEARCH_MANAGE
|
|
96
|
-
],
|
|
97
|
-
track: [
|
|
98
|
-
QoniScopes.TRACK_READ,
|
|
99
|
-
QoniScopes.TRACK_MANAGE
|
|
100
|
-
]
|
|
101
|
-
};
|
|
102
|
-
var KNOWN_SCOPES = Object.values(QoniScopes);
|
|
103
|
-
var QoniScopeBundles = {
|
|
104
|
-
GUMEM_READONLY: [QoniScopes.GUMEM_MEMORY_READ, QoniScopes.GUMEM_PROFILE_READ],
|
|
105
|
-
GUMEM_SESSION_RECALL: [
|
|
106
|
-
QoniScopes.GUMEM_MEMORY_READ,
|
|
107
|
-
QoniScopes.GUMEM_MEMORY_WRITE,
|
|
108
|
-
QoniScopes.GUMEM_MESSAGE_WRITE
|
|
109
|
-
],
|
|
110
|
-
GUMEM_WRITE: [
|
|
111
|
-
QoniScopes.GUMEM_SESSION_CREATE,
|
|
112
|
-
QoniScopes.GUMEM_MESSAGE_WRITE,
|
|
113
|
-
QoniScopes.GUMEM_ACTION_WRITE
|
|
114
|
-
],
|
|
115
|
-
// One bundle per WebAgent product = [read, manage].
|
|
116
|
-
DO_ANYTHING: [
|
|
117
|
-
QoniScopes.DO_ANYTHING_READ,
|
|
118
|
-
QoniScopes.DO_ANYTHING_MANAGE
|
|
119
|
-
],
|
|
120
|
-
WEB_SEARCH: [
|
|
121
|
-
QoniScopes.WEB_SEARCH_READ,
|
|
122
|
-
QoniScopes.WEB_SEARCH_MANAGE
|
|
123
|
-
],
|
|
124
|
-
DEEP_RESEARCH: [
|
|
125
|
-
QoniScopes.DEEP_RESEARCH_READ,
|
|
126
|
-
QoniScopes.DEEP_RESEARCH_MANAGE
|
|
127
|
-
],
|
|
128
|
-
TRACK: [
|
|
129
|
-
QoniScopes.TRACK_READ,
|
|
130
|
-
QoniScopes.TRACK_MANAGE
|
|
131
|
-
]
|
|
132
|
-
};
|
|
133
|
-
|
|
134
59
|
// src/types.ts
|
|
135
60
|
function isJsonObject(value) {
|
|
136
61
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
@@ -214,7 +139,7 @@ function errorFromPayload(status, payload, fallbackMessage) {
|
|
|
214
139
|
const source = detailObject || (isJsonObject(payload) ? payload : {});
|
|
215
140
|
const code = stringField(source, "code") || stringField(source, "apiCode") || statusCodeToCode(status);
|
|
216
141
|
const rawMessage = stringField(source, "message") || stringField(source, "detail") || fallbackMessage;
|
|
217
|
-
const message = appendOnboardingHint(
|
|
142
|
+
const message = code === "eak.delegation.no_allowed_scopes" ? "This AccessKey has no permission scopes. In Qoni Console, open its Permission scope settings, enable the policy needed for this call, then retry." : appendOnboardingHint(
|
|
218
143
|
appendDeniedScopes(appendUpstreamDescription(rawMessage, source), source),
|
|
219
144
|
code
|
|
220
145
|
);
|
|
@@ -231,7 +156,7 @@ function errorFromPayload(status, payload, fallbackMessage) {
|
|
|
231
156
|
if (isDelegationRequired(code)) return new QoniDelegationRequiredError(message, options);
|
|
232
157
|
if (status === 401) return new QoniAuthError(message, options);
|
|
233
158
|
if (status === 403 || isPermissionDenied(code)) {
|
|
234
|
-
return new QoniPermissionDeniedError(
|
|
159
|
+
return new QoniPermissionDeniedError(message, options);
|
|
235
160
|
}
|
|
236
161
|
if (status === 400 || status === 422) return new QoniValidationError(message, options);
|
|
237
162
|
if (status === 429) return new QoniRateLimitError(message, options);
|
|
@@ -266,17 +191,14 @@ function appendUpstreamDescription(message, source) {
|
|
|
266
191
|
}
|
|
267
192
|
var ONBOARDING_HINTS = {
|
|
268
193
|
"eak.delegation.user_not_bound": "Hint: the userId is not in the GenAuth userpool bound to this credential. Resolve a real user with qoni.resolveAnyBoundUser() (demo/smoke) or qoni.currentUser({ accessToken }).",
|
|
269
|
-
"eak.genauth.userpool_binding_missing": "Hint: bind the Qoni credential to a GenAuth userpool before calling genauth.users.*."
|
|
194
|
+
"eak.genauth.userpool_binding_missing": "Hint: bind the Qoni credential to a GenAuth userpool before calling genauth.users.*.",
|
|
195
|
+
"eak.delegation.scope_not_allowed": "Hint: enable the denied scopes in this AccessKey's Permission scope settings in Qoni Console."
|
|
270
196
|
};
|
|
271
197
|
function appendOnboardingHint(message, code) {
|
|
272
198
|
const hint = ONBOARDING_HINTS[code];
|
|
273
199
|
if (!hint || message.includes(hint)) return message;
|
|
274
200
|
return `${message} ${hint}`;
|
|
275
201
|
}
|
|
276
|
-
function appendKnownScopes(message) {
|
|
277
|
-
if (message.includes("Known scopes:")) return message;
|
|
278
|
-
return `${message} (Known scopes: ${KNOWN_SCOPES.join(", ")})`;
|
|
279
|
-
}
|
|
280
202
|
function statusCodeToCode(status) {
|
|
281
203
|
if (status === 401) return "auth.failed";
|
|
282
204
|
if (status === 403) return "permission_denied";
|
|
@@ -308,6 +230,8 @@ var QoniEventTypes = {
|
|
|
308
230
|
Interaction: "interaction",
|
|
309
231
|
/** A live screenshot frame (opt in with `capture: { screenshots: true }`); image on `event.image`. */
|
|
310
232
|
Screenshot: "screenshot",
|
|
233
|
+
/** The browser viewer moved to a new page or needs a fresh attachment. Use `event.data.liveUrl` for the live preview. */
|
|
234
|
+
BrowserLiveUrlChanged: "browserLiveUrlChanged",
|
|
311
235
|
/** Terminal — the run finished; outcome + output in `event.data` (cost is on the `RunResult`). */
|
|
312
236
|
Done: "done",
|
|
313
237
|
// --- Web Search ---
|
|
@@ -438,7 +362,6 @@ var WIRE_TO_SEMANTIC = {
|
|
|
438
362
|
"run.recording_started": "progress",
|
|
439
363
|
"run.recording_paused": "progress",
|
|
440
364
|
"run.recording_finalized": "progress",
|
|
441
|
-
"run.browser_live_url_changed": "progress",
|
|
442
365
|
// side-channel
|
|
443
366
|
"run.feedback_submitted": "progress"
|
|
444
367
|
};
|
|
@@ -500,6 +423,18 @@ function normalizeRunEvent(wire, options = {}) {
|
|
|
500
423
|
return { ...base, type: "screenshot", data: sData, image, isTerminal: false };
|
|
501
424
|
}
|
|
502
425
|
}
|
|
426
|
+
if (wireType === "run.browser_live_url_changed") {
|
|
427
|
+
const liveUrl = asString(c.liveUrl);
|
|
428
|
+
if (!liveUrl) return null;
|
|
429
|
+
const data2 = {
|
|
430
|
+
liveUrl,
|
|
431
|
+
supportsLivePump: c.supportsLivePump === true,
|
|
432
|
+
forceViewerReload: c.forceViewerReload === true
|
|
433
|
+
};
|
|
434
|
+
const providerSessionId = asString(c.providerSessionId);
|
|
435
|
+
if (providerSessionId) data2.providerSessionId = providerSessionId;
|
|
436
|
+
return { ...base, type: "browserLiveUrlChanged", data: data2, isTerminal: false };
|
|
437
|
+
}
|
|
503
438
|
if (wireType === INTERACTION) {
|
|
504
439
|
const interaction = normalizeInteraction(payload);
|
|
505
440
|
if (interaction) {
|
|
@@ -1440,6 +1375,81 @@ function createQoniNamespace(_transport, delegateToken, completeDelegateToken) {
|
|
|
1440
1375
|
};
|
|
1441
1376
|
}
|
|
1442
1377
|
|
|
1378
|
+
// src/scopes.ts
|
|
1379
|
+
var QoniScopes = {
|
|
1380
|
+
GUMEM_SESSION_CREATE: "gumem.session:create",
|
|
1381
|
+
GUMEM_MESSAGE_WRITE: "gumem.message:write",
|
|
1382
|
+
GUMEM_MEMORY_READ: "gumem.memory:read",
|
|
1383
|
+
GUMEM_MEMORY_WRITE: "gumem.memory:write",
|
|
1384
|
+
GUMEM_MEMORY_DELETE: "gumem.memory:delete",
|
|
1385
|
+
GUMEM_SEARCH_RUN: "gumem.search:run",
|
|
1386
|
+
GUMEM_ADMIN_MANAGE: "gumem.admin:manage",
|
|
1387
|
+
GUMEM_RESOURCE_WRITE: "gumem.resource:write",
|
|
1388
|
+
GUMEM_ACTION_WRITE: "gumem.action:write",
|
|
1389
|
+
GUMEM_ACTION_READ: "gumem.action:read",
|
|
1390
|
+
GUMEM_PROFILE_READ: "gumem.profile:read",
|
|
1391
|
+
// WebAgent products: exactly two verbs per product — `read` (observe) and
|
|
1392
|
+
// `manage` (anything that changes execution state). See
|
|
1393
|
+
// wa/docs/qoni-sdk-public-surface.md §3.
|
|
1394
|
+
DO_ANYTHING_READ: "webagent.do_anything:read",
|
|
1395
|
+
DO_ANYTHING_MANAGE: "webagent.do_anything:manage",
|
|
1396
|
+
WEB_SEARCH_READ: "webagent.web_search:read",
|
|
1397
|
+
WEB_SEARCH_MANAGE: "webagent.web_search:manage",
|
|
1398
|
+
DEEP_RESEARCH_READ: "webagent.deep_research:read",
|
|
1399
|
+
DEEP_RESEARCH_MANAGE: "webagent.deep_research:manage",
|
|
1400
|
+
TRACK_READ: "webagent.track:read",
|
|
1401
|
+
TRACK_MANAGE: "webagent.track:manage"
|
|
1402
|
+
};
|
|
1403
|
+
var QoniProductScopes = {
|
|
1404
|
+
doAnything: [
|
|
1405
|
+
QoniScopes.DO_ANYTHING_READ,
|
|
1406
|
+
QoniScopes.DO_ANYTHING_MANAGE
|
|
1407
|
+
],
|
|
1408
|
+
webSearch: [
|
|
1409
|
+
QoniScopes.WEB_SEARCH_READ,
|
|
1410
|
+
QoniScopes.WEB_SEARCH_MANAGE
|
|
1411
|
+
],
|
|
1412
|
+
deepResearch: [
|
|
1413
|
+
QoniScopes.DEEP_RESEARCH_READ,
|
|
1414
|
+
QoniScopes.DEEP_RESEARCH_MANAGE
|
|
1415
|
+
],
|
|
1416
|
+
track: [
|
|
1417
|
+
QoniScopes.TRACK_READ,
|
|
1418
|
+
QoniScopes.TRACK_MANAGE
|
|
1419
|
+
]
|
|
1420
|
+
};
|
|
1421
|
+
var KNOWN_SCOPES = Object.values(QoniScopes);
|
|
1422
|
+
var QoniScopeBundles = {
|
|
1423
|
+
GUMEM_READONLY: [QoniScopes.GUMEM_MEMORY_READ, QoniScopes.GUMEM_PROFILE_READ],
|
|
1424
|
+
GUMEM_SESSION_RECALL: [
|
|
1425
|
+
QoniScopes.GUMEM_MEMORY_READ,
|
|
1426
|
+
QoniScopes.GUMEM_MEMORY_WRITE,
|
|
1427
|
+
QoniScopes.GUMEM_MESSAGE_WRITE
|
|
1428
|
+
],
|
|
1429
|
+
GUMEM_WRITE: [
|
|
1430
|
+
QoniScopes.GUMEM_SESSION_CREATE,
|
|
1431
|
+
QoniScopes.GUMEM_MESSAGE_WRITE,
|
|
1432
|
+
QoniScopes.GUMEM_ACTION_WRITE
|
|
1433
|
+
],
|
|
1434
|
+
// One bundle per WebAgent product = [read, manage].
|
|
1435
|
+
DO_ANYTHING: [
|
|
1436
|
+
QoniScopes.DO_ANYTHING_READ,
|
|
1437
|
+
QoniScopes.DO_ANYTHING_MANAGE
|
|
1438
|
+
],
|
|
1439
|
+
WEB_SEARCH: [
|
|
1440
|
+
QoniScopes.WEB_SEARCH_READ,
|
|
1441
|
+
QoniScopes.WEB_SEARCH_MANAGE
|
|
1442
|
+
],
|
|
1443
|
+
DEEP_RESEARCH: [
|
|
1444
|
+
QoniScopes.DEEP_RESEARCH_READ,
|
|
1445
|
+
QoniScopes.DEEP_RESEARCH_MANAGE
|
|
1446
|
+
],
|
|
1447
|
+
TRACK: [
|
|
1448
|
+
QoniScopes.TRACK_READ,
|
|
1449
|
+
QoniScopes.TRACK_MANAGE
|
|
1450
|
+
]
|
|
1451
|
+
};
|
|
1452
|
+
|
|
1443
1453
|
// src/genauth.ts
|
|
1444
1454
|
function createGenAuthNamespace(transport, options = {}) {
|
|
1445
1455
|
return {
|