@muhkoo/connect 0.10.10-alpha.0 → 0.10.11-alpha.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/dist/browser/index.js +142 -11
- package/dist/browser/index.js.map +1 -1
- package/dist/connect.d.ts +190 -3
- package/dist/server/index.js +142 -11
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
package/dist/connect.d.ts
CHANGED
|
@@ -1905,6 +1905,10 @@ interface VaultFactor {
|
|
|
1905
1905
|
createdAt?: number;
|
|
1906
1906
|
/** Display hint for gated factors ("m•••@gmail.com") — list responses only. */
|
|
1907
1907
|
masked?: string;
|
|
1908
|
+
/** Passkey's origin (RP id) — list responses only. A passkey only unlocks
|
|
1909
|
+
* from this host or a subdomain of it, so apps on several hosts enroll one
|
|
1910
|
+
* per origin. */
|
|
1911
|
+
rpId?: string;
|
|
1908
1912
|
}
|
|
1909
1913
|
interface AuthClientOptions {
|
|
1910
1914
|
/** Absolute URL of the accelerator worker (no trailing slash required). */
|
|
@@ -2001,7 +2005,11 @@ declare class AuthClient {
|
|
|
2001
2005
|
* Read a factor record for `username` (returns an indistinguishable decoy if
|
|
2002
2006
|
* absent). Gated types (email) require the recover `verifyToken`.
|
|
2003
2007
|
*/
|
|
2004
|
-
vaultRead(username: string, factorType: VaultFactor["type"], verifyToken?: string
|
|
2008
|
+
vaultRead(username: string, factorType: VaultFactor["type"], verifyToken?: string,
|
|
2009
|
+
/** Passkeys are per-origin: naming the caller's host returns THAT origin's
|
|
2010
|
+
* passkey instead of whichever was enrolled first (which WebAuthn would
|
|
2011
|
+
* refuse). Ignored for other factor types. */
|
|
2012
|
+
rpId?: string): Promise<{
|
|
2005
2013
|
factor: VaultFactor | null;
|
|
2006
2014
|
}>;
|
|
2007
2015
|
/**
|
|
@@ -2669,7 +2677,18 @@ declare class ZkAuth {
|
|
|
2669
2677
|
label?: string;
|
|
2670
2678
|
createdAt?: number;
|
|
2671
2679
|
masked?: string;
|
|
2680
|
+
rpId?: string;
|
|
2672
2681
|
}>>;
|
|
2682
|
+
/**
|
|
2683
|
+
* Is a passkey enrolled that can unlock from THIS origin?
|
|
2684
|
+
*
|
|
2685
|
+
* Passkeys are origin-bound, so an app served on both a custom domain and the
|
|
2686
|
+
* platform host needs one per host. Use this to decide whether to offer
|
|
2687
|
+
* "Unlock with passkey" or go straight to sign-in — prompting with another
|
|
2688
|
+
* origin's passkey fails with a raw WebAuthn error. Requires a session
|
|
2689
|
+
* (metadata read); returns false when signed out or unsupported.
|
|
2690
|
+
*/
|
|
2691
|
+
hasPasskeyForThisOrigin(): Promise<boolean>;
|
|
2673
2692
|
/** Remove a login method by id (can't remove your only one). Session-authed. */
|
|
2674
2693
|
removeFactor(id: string): Promise<void>;
|
|
2675
2694
|
/** Sign out: clears the session, identity, and persisted token. */
|
|
@@ -2767,6 +2786,14 @@ interface HttpClientOptions {
|
|
|
2767
2786
|
* shared-space (messaging) websockets.
|
|
2768
2787
|
*/
|
|
2769
2788
|
apiKey?: string;
|
|
2789
|
+
/**
|
|
2790
|
+
* A scoped, expiring **access token** (`mk_<env>_at_…`) — the non-ZK
|
|
2791
|
+
* machine-to-machine credential. It resolves through the SAME accelerator
|
|
2792
|
+
* path as an app key and rides the same `X-Muhkoo-Key` header; when present
|
|
2793
|
+
* it takes precedence over {@link apiKey}. Use it for server-side / CI
|
|
2794
|
+
* callers that shouldn't carry the app's publishable key.
|
|
2795
|
+
*/
|
|
2796
|
+
accessToken?: string;
|
|
2770
2797
|
/** Returns the current user session token, or `null` when logged out. */
|
|
2771
2798
|
getSessionToken?: () => string | null;
|
|
2772
2799
|
/** Custom fetch — defaults to `globalThis.fetch`. */
|
|
@@ -2795,6 +2822,8 @@ declare class HttpClient {
|
|
|
2795
2822
|
/** Origin of {@link baseUrl} — credentials are only attached same-origin. */
|
|
2796
2823
|
private readonly baseOrigin;
|
|
2797
2824
|
private readonly apiKey;
|
|
2825
|
+
/** Scoped machine access token — takes precedence over {@link apiKey} on `X-Muhkoo-Key`. */
|
|
2826
|
+
private readonly accessToken;
|
|
2798
2827
|
private readonly getSessionToken;
|
|
2799
2828
|
private readonly onUnauthorized;
|
|
2800
2829
|
private readonly fetchFn;
|
|
@@ -4804,6 +4833,78 @@ declare class FunctionsNamespace {
|
|
|
4804
4833
|
private path;
|
|
4805
4834
|
}
|
|
4806
4835
|
|
|
4836
|
+
/**
|
|
4837
|
+
* `client.accessTokens` — manage an app's **access tokens**: scoped, expiring,
|
|
4838
|
+
* non-ZK machine-to-machine credentials (`mk_<env>_at_…`).
|
|
4839
|
+
*
|
|
4840
|
+
* const { plaintext } = await client.accessTokens.create(appId, {
|
|
4841
|
+
* scopes: ["db:read", "db:write"], env: "live", expiresInDays: 30,
|
|
4842
|
+
* label: "ci-runner",
|
|
4843
|
+
* });
|
|
4844
|
+
* // hand `plaintext` to the machine caller as its ClientOptions.accessToken
|
|
4845
|
+
*
|
|
4846
|
+
* These are MANAGEMENT calls — creating/listing/revoking tokens is authorized by
|
|
4847
|
+
* the developer session (same as the `agents`/`functions` namespaces). The token
|
|
4848
|
+
* itself resolves through the SAME accelerator path as an app key (the
|
|
4849
|
+
* `X-Muhkoo-Key` header), but is scoped to a fixed vocabulary of permissions and
|
|
4850
|
+
* expires. The plaintext is returned ONCE, on create — store it then; it can't
|
|
4851
|
+
* be read back.
|
|
4852
|
+
*/
|
|
4853
|
+
|
|
4854
|
+
/** The fixed vocabulary of permissions an access token can be granted. */
|
|
4855
|
+
type Scope = "db:read" | "db:write" | "kv:read" | "kv:write" | "storage:read" | "storage:write" | "messages:read" | "messages:write" | "functions:invoke" | "ai:infer";
|
|
4856
|
+
/** All valid {@link Scope}s, in canonical order. */
|
|
4857
|
+
declare const ACCESS_TOKEN_SCOPES: Scope[];
|
|
4858
|
+
/** A token as returned by {@link AccessTokensNamespace.list} (never the plaintext). */
|
|
4859
|
+
interface AccessTokenInfo {
|
|
4860
|
+
keyId: string;
|
|
4861
|
+
env: "live" | "test";
|
|
4862
|
+
scopes: string[];
|
|
4863
|
+
/** Epoch ms, or absent if the token never expires. */
|
|
4864
|
+
expiresAt?: number;
|
|
4865
|
+
label?: string;
|
|
4866
|
+
createdAt: number;
|
|
4867
|
+
revoked: boolean;
|
|
4868
|
+
/** True once past {@link expiresAt}. */
|
|
4869
|
+
expired: boolean;
|
|
4870
|
+
}
|
|
4871
|
+
/** The editor-settable fields when minting an access token. */
|
|
4872
|
+
interface CreateAccessTokenInput {
|
|
4873
|
+
scopes: string[];
|
|
4874
|
+
/** Defaults to `live` on the accelerator. */
|
|
4875
|
+
env?: "live" | "test";
|
|
4876
|
+
/** Omit for a non-expiring token. */
|
|
4877
|
+
expiresInDays?: number;
|
|
4878
|
+
label?: string;
|
|
4879
|
+
}
|
|
4880
|
+
/** Create response — includes the one-time {@link plaintext} secret. */
|
|
4881
|
+
interface CreatedAccessToken {
|
|
4882
|
+
keyId: string;
|
|
4883
|
+
env: "live" | "test";
|
|
4884
|
+
/** The `mk_<env>_at_…` secret. Returned ONCE — store it now. */
|
|
4885
|
+
plaintext: string;
|
|
4886
|
+
scopes: string[];
|
|
4887
|
+
expiresAt: number;
|
|
4888
|
+
label?: string;
|
|
4889
|
+
createdAt: number;
|
|
4890
|
+
}
|
|
4891
|
+
interface AccessTokensNamespaceDeps {
|
|
4892
|
+
http: HttpClient;
|
|
4893
|
+
}
|
|
4894
|
+
declare class AccessTokensNamespace {
|
|
4895
|
+
private readonly deps;
|
|
4896
|
+
constructor(deps: AccessTokensNamespaceDeps);
|
|
4897
|
+
/** List the app's access tokens (metadata only — never the plaintext). */
|
|
4898
|
+
list(appId: string): Promise<AccessTokenInfo[]>;
|
|
4899
|
+
/** Mint an access token (owner/editor only). The plaintext is returned once. */
|
|
4900
|
+
create(appId: string, input: CreateAccessTokenInput): Promise<CreatedAccessToken>;
|
|
4901
|
+
/** Revoke an access token by its `keyId`. */
|
|
4902
|
+
revoke(appId: string, keyId: string): Promise<{
|
|
4903
|
+
revoked: boolean;
|
|
4904
|
+
}>;
|
|
4905
|
+
private path;
|
|
4906
|
+
}
|
|
4907
|
+
|
|
4807
4908
|
/** The hosted Muhkoo Accelerator — the default {@link ClientOptions.baseUrl}. */
|
|
4808
4909
|
declare const DEFAULT_BASE_URL = "https://api.muhkoo.dev";
|
|
4809
4910
|
/** The hosted auth SPA — the default {@link ClientOptions.authBaseUrl}. */
|
|
@@ -4819,6 +4920,15 @@ interface ClientOptions {
|
|
|
4819
4920
|
* New integrations should always pass one.
|
|
4820
4921
|
*/
|
|
4821
4922
|
apiKey?: string;
|
|
4923
|
+
/**
|
|
4924
|
+
* A scoped, expiring **access token** (`mk_<env>_at_…`) — the non-ZK
|
|
4925
|
+
* machine-to-machine credential. It resolves through the SAME accelerator
|
|
4926
|
+
* path as {@link apiKey} (both ride the `X-Muhkoo-Key` header) and, when
|
|
4927
|
+
* set, takes precedence over it. Use it for server-side / CI callers that
|
|
4928
|
+
* shouldn't carry the app's publishable key. Mint one with
|
|
4929
|
+
* `client.accessTokens.create(...)`.
|
|
4930
|
+
*/
|
|
4931
|
+
accessToken?: string;
|
|
4822
4932
|
/**
|
|
4823
4933
|
* Absolute URL of the accelerator (trailing slash optional). Defaults to
|
|
4824
4934
|
* the hosted Muhkoo Accelerator ({@link DEFAULT_BASE_URL}); override to
|
|
@@ -4900,6 +5010,8 @@ declare class Client {
|
|
|
4900
5010
|
readonly agents: AgentsNamespace;
|
|
4901
5011
|
/** Serverless functions — `client.functions.deploy(appId, …)`, etc. */
|
|
4902
5012
|
readonly functions: FunctionsNamespace;
|
|
5013
|
+
/** Access tokens — `client.accessTokens.create(appId, …)`, etc. */
|
|
5014
|
+
readonly accessTokens: AccessTokensNamespace;
|
|
4903
5015
|
/** Offline cache + sync — `client.offline.status`, `client.offline.snapshot`, etc. */
|
|
4904
5016
|
readonly offline: OfflineManager;
|
|
4905
5017
|
private readonly session;
|
|
@@ -4934,6 +5046,75 @@ declare class Client {
|
|
|
4934
5046
|
recoverSession(): Promise<boolean>;
|
|
4935
5047
|
}
|
|
4936
5048
|
|
|
5049
|
+
/**
|
|
5050
|
+
* Passkey factor (M1.1) — WebAuthn with the **PRF extension**.
|
|
5051
|
+
*
|
|
5052
|
+
* A passkey becomes a device-bound, platform-synced source of a stable secret:
|
|
5053
|
+
* for a fixed salt, the authenticator's PRF returns the same 32 bytes, which we
|
|
5054
|
+
* HKDF into an AES key that wraps the master seed. The server never sees the
|
|
5055
|
+
* passkey — it's purely a local key source; the ZK proof remains the server auth.
|
|
5056
|
+
*
|
|
5057
|
+
* BROWSER ONLY (`navigator.credentials`). The PRF extension fields aren't in the
|
|
5058
|
+
* standard DOM types yet, so they're reached through narrow casts.
|
|
5059
|
+
*/
|
|
5060
|
+
/** Whether this environment can do WebAuthn at all. (PRF support is checked at enroll.) */
|
|
5061
|
+
declare function passkeySupported(): boolean;
|
|
5062
|
+
/**
|
|
5063
|
+
* Whether this browser's authenticator can do the **PRF extension** our passkey
|
|
5064
|
+
* factor needs. A browser can save passkeys (e.g. for password autofill) yet not
|
|
5065
|
+
* expose PRF — PRF is what derives the stable secret we wrap the seed under, so a
|
|
5066
|
+
* passkey without it is useless to us.
|
|
5067
|
+
*
|
|
5068
|
+
* Uses `PublicKeyCredential.getClientCapabilities()` (the `extension:prf` cap)
|
|
5069
|
+
* where available. Returns:
|
|
5070
|
+
* - `true` — PRF is supported,
|
|
5071
|
+
* - `false` — definitively NOT supported (hide the option),
|
|
5072
|
+
* - `null` — couldn't determine (older browser without the capabilities API);
|
|
5073
|
+
* the caller may optimistically allow and let enroll surface a real
|
|
5074
|
+
* error if it turns out PRF isn't there.
|
|
5075
|
+
*/
|
|
5076
|
+
declare function passkeyPrfCapable(): Promise<boolean | null>;
|
|
5077
|
+
/** Best-effort registrable RP id — the host. Apps spanning subdomains should pass
|
|
5078
|
+
* the parent domain (e.g. "muhkoo.dev") explicitly. */
|
|
5079
|
+
declare function defaultRpId(): string;
|
|
5080
|
+
/**
|
|
5081
|
+
* Can a passkey enrolled under `rpId` be used from the CURRENT origin?
|
|
5082
|
+
*
|
|
5083
|
+
* WebAuthn only accepts an RP id that is the origin's own host or a registrable
|
|
5084
|
+
* *parent* of it — so a passkey enrolled on `app.example.com` is unusable on
|
|
5085
|
+
* `app.example.net`, and one enrolled on a full host is unusable from a sibling
|
|
5086
|
+
* host. An app served on BOTH a custom domain and the platform host therefore
|
|
5087
|
+
* needs one passkey per origin.
|
|
5088
|
+
*
|
|
5089
|
+
* Call this BEFORE `navigator.credentials.get()`: passing a foreign rpId throws
|
|
5090
|
+
* a raw "The requested RPID did not match the origin or related origins", which
|
|
5091
|
+
* is a dead end for the user. Checking first lets the caller fall back to normal
|
|
5092
|
+
* sign-in (and offer to enroll a passkey for this origin) instead.
|
|
5093
|
+
*/
|
|
5094
|
+
declare function rpIdUsableForOrigin(rpId: string | undefined | null, host?: string): boolean;
|
|
5095
|
+
/** Thrown when the account's passkey belongs to a different origin. Callers
|
|
5096
|
+
* should treat this as "no passkey here" and fall back to another factor. */
|
|
5097
|
+
declare class PasskeyOriginError extends Error {
|
|
5098
|
+
readonly code = "passkey_wrong_origin";
|
|
5099
|
+
constructor(message?: string);
|
|
5100
|
+
}
|
|
5101
|
+
interface PasskeyEnrollment {
|
|
5102
|
+
credentialId: Uint8Array;
|
|
5103
|
+
prfSalt: Uint8Array;
|
|
5104
|
+
prfOutput: Uint8Array;
|
|
5105
|
+
}
|
|
5106
|
+
/**
|
|
5107
|
+
* Create a passkey with PRF and return its credential id, a fresh PRF salt, and
|
|
5108
|
+
* the PRF output for that salt. Throws if the authenticator can't do PRF.
|
|
5109
|
+
*/
|
|
5110
|
+
declare function createPasskeyWithPrf(opts: {
|
|
5111
|
+
rpId: string;
|
|
5112
|
+
rpName: string;
|
|
5113
|
+
username: string;
|
|
5114
|
+
}): Promise<PasskeyEnrollment>;
|
|
5115
|
+
/** Evaluate a passkey's PRF for `salt` → 32 bytes. Used at recover/login. */
|
|
5116
|
+
declare function evaluatePasskeyPrf(rpId: string, credentialId: Uint8Array, salt: Uint8Array): Promise<Uint8Array>;
|
|
5117
|
+
|
|
4937
5118
|
/**
|
|
4938
5119
|
* Muhkoo app decorators — declare your app's agent-facing surface in code, then
|
|
4939
5120
|
* "eject" a system prompt you hand to a Programmable Agent.
|
|
@@ -4996,6 +5177,11 @@ interface MuhkooDBMeta {
|
|
|
4996
5177
|
table?: string;
|
|
4997
5178
|
/** Read-only by default. */
|
|
4998
5179
|
access?: MuhkooDBAccess;
|
|
5180
|
+
/**
|
|
5181
|
+
* Backend-only table — omitted from {@link ejectAgentPrompt}. Use for tables
|
|
5182
|
+
* an agent should never be told about (server-managed / internal state).
|
|
5183
|
+
*/
|
|
5184
|
+
backend?: boolean;
|
|
4999
5185
|
description: string;
|
|
5000
5186
|
}
|
|
5001
5187
|
/** A serverless function the agent can invoke via `call_function`. */
|
|
@@ -5012,6 +5198,7 @@ interface TableEntry {
|
|
|
5012
5198
|
table: string;
|
|
5013
5199
|
access: MuhkooDBAccess;
|
|
5014
5200
|
description: string;
|
|
5201
|
+
backend: boolean;
|
|
5015
5202
|
}
|
|
5016
5203
|
interface FunctionEntry {
|
|
5017
5204
|
name: string;
|
|
@@ -5832,5 +6019,5 @@ declare class KeyringClient implements KeyringTransport {
|
|
|
5832
6019
|
fetchMetadata(): Promise<SpaceMetadata | null>;
|
|
5833
6020
|
}
|
|
5834
6021
|
|
|
5835
|
-
export { AES_GCM_IV_BYTES, AES_GCM_KEY_BYTES, AES_GCM_TAG_BYTES, AgentsNamespace, AuthClient, AuthNamespace, AuthPublicInput, Authenticator, BlockEngine, BroadcastChannel, BroadcastChannelEvents, ChannelExistsError, ChannelNotFoundError, ChunkCipher, Client, ConnectivityManager, DEFAULT_AUTH_BASE_URL, DEFAULT_BASE_URL, DEFAULT_FN_HOST_SUFFIX, DbCache, DoubleRatchet, DoubleRatchetCipher, DoubleRatchetManager, EncryptedSession, EventCore, EventCoreEvents, Field, Field as FieldElement, FileStorage, FunctionsNamespace, HLC, HashKnowledge, HttpClient, HttpError, IndexedDbStore, KEEPER_MEMBER_ID, KeyStore, KeyringClient, KvCache, KvNamespace, LocalEngineHost, LocalStorageSessionStore, MemorySessionStore, Message, Message as MessageDefault, MessageNamespace, MuhkooAgent, MuhkooDB, MuhkooFunction, MuhkooSpace, NoopStore, OfflineLockedError, OfflineManager, OutboundQueue, P2P_SUBJECT, PBKDF2_DEFAULT_ITERATIONS, PREIMAGE_POK_VERIFICATION_KEY, Packet, PeerExchange, PeerNetwork, PersonalSpaceClient, Poseidon, PreimagePoK, ReedSolomonCodec, Space as Room, SerializeMessage, SessionState, ShardCache, ShardClient, SharedSpaceClient, SnapshotNamespace, Space, SpaceCache, SpaceKeyring, SpaceNamespace, SpacePacketCipher, SpaceSignaler, StorageNamespace, SyncEngine, VaultUnavailableError, WSTransport, WebRtcTransport, WorkerEngineHost, ZERO_HLC, ZkAuth, buildCommitment, compareHlc, compilePrograms, decodeFromHex, decorators, decryptAesGcm, defaultCircuitUrls, defaultSessionStore, deleteBeatsWrite, deleteRegister, deriveAesKeyFromPassphrase, deriveBitsHkdf, deriveIdentity, deriveIdentityFromSeed, deriveMasterSeedFromPassword, ejectAgentPrompt, ejectAgentTools, emptyMap, emptyRegister, encodeToHex, encryptAesGcm, exportPublicKeyBase64, exportPublicKeyHex, generateAuthProof, generatePkce, getMuhkooAppDescriptor, getSubtle, initBn128Wasm, initRsWasm, initializeCircuits, isNewer, isOfflineCapable, isP2pCapable, isProvisional, manifestToStat, materializeRow, mergeMap, mergeMessage, mergeRegister, messageKey, pack, padHandle, poseidonHash, protocol, provisionalHandle, quickVerify, randomBytes, randomState, sealSeed, shardHash, signMessage, stableStringify, toField, tombstoneRow, unpack, unsealSeed, unwrapWithPassphrase, verify, verifyGroth16, verifyHashKnowledge, verifyPreimagePoK, wrapWithPassphrase, writeBeatsTombstone, writeColumns, writeRegister };
|
|
5836
|
-
export type { ACL, ACLEntry, AgentConfig, AgentCreateInput, AgentDbToolMode, AgentProvisioned, AgentScopeOpts, AgentSkill, AgentToolsConfig, AgentTrigger, AgentTriggerType, AgentUpdateInput, AgentsNamespaceDeps, AttachedPeerNetwork, AuthClientOptions, AuthKeyPair, AuthSuccess, AuthToken, AuthType, AuthUser, BlockStore, Bn128WasmInstance, BroadcastChannelEvent, BroadcastChannelOptions, CachedSpaceMessage, ChannelLike, ChunkKeyMaterial, ChunkManifest, CipherFrame, CipherMessage, CipherMessageHeader, CircuitBufferConfig, CircuitUrls, ClientOptions, ConnectivityOptions, ConnectivityState, DbQueryPage, DehydratedKeypair, DehydratedKeys, DoubleRatchetCipherDeps, ECDHCurve, EncodeResult, EngineHandle, EngineHost, EphemeralEvent, EpochKeyProvider, FileManifest, FileNamespaceDeps, FileStat, FileStorageOptions, FunctionCaps, FunctionConfig, FunctionDeployInput, FunctionInvokeOptions, FunctionScopeOpts, FunctionTrigger, FunctionTriggerType, FunctionTriggers, FunctionUpdateInput, FunctionsNamespaceDeps, Groth16Proof, Hasher, HlcParts, HlcState, HttpClientOptions, IncomingFrame, KeyExchangeFrame, KeyPair, Keypair, KeyringClientDeps, KeyringTransport, KvEntry, KvNamespaceDeps, LoginOptions, LwwMap, LwwRegister, MessageBody, MessageDeletedEvent, MessageEntry, MessageEvent, MessageHeaders, MessageNamespaceDeps, MessageOp, MessageOptions, MessageSubscription, MuhkooAgentMeta, MuhkooAgentToolsConfig, MuhkooAppDescriptor, MuhkooDBAccess, MuhkooDBMeta, MuhkooFunctionMeta, MuhkooMessageEvent, MuhkooSpaceMeta, OAuthProvider, OfflineEntry, OfflineManagerDeps, OfflineStore, OutSink, PacketCipher, PacketHeaders, PacketOptions, Participant, PeerBlockSource, PeerExchangeOptions, PeerId, PeerNetworkOptions, PeerTransport, Permission, PermissionCheckRequest, PermissionCheckResult, PersonalSpaceClientOptions, Pkce, PublicKeyJWK, QueueEntry, RatchetState, ReceiveResult, RegisterParams, Replayer, Role, SpaceDeps as RoomDeps, SpaceFileMetadata as RoomFileMetadata, SealedHandoff, SealedHeaders, Session, SessionOptions, SessionStore, SetOptions, ShardByteCache, ShardClientOptions, SharedSpaceClientOptions, SignalEnvelope, SignalKind, SignalingSpace, SnapshotNamespaceDeps, SnarkProof, SpaceChannelLike, SpaceCursor, SpaceDeps, SpaceFileMetadata, SpaceKeyCache, SpaceKeyringDeps, SpaceMessageEvent, SpaceNamespaceDeps, SpaceOfflineAdapter, StorageChangeEvent, StoreName, StoredSession, Subscription, UserIdentity, VaultFactor, VerificationKey, WSMessage, WSMessageType, WSTransportOptions, WebRtcTransportOptions, WrappedPayload, WriteFileInput, WriteFileOptions, WriteToShardsInput, ZkAuthDeps, ZkAuthenticateRequest, ZkChallengeResponse, ZkCompiled, ZkIdentity, ZkRegisterRequest, ZkRegisterResponse };
|
|
6022
|
+
export { ACCESS_TOKEN_SCOPES, AES_GCM_IV_BYTES, AES_GCM_KEY_BYTES, AES_GCM_TAG_BYTES, AccessTokensNamespace, AgentsNamespace, AuthClient, AuthNamespace, AuthPublicInput, Authenticator, BlockEngine, BroadcastChannel, BroadcastChannelEvents, ChannelExistsError, ChannelNotFoundError, ChunkCipher, Client, ConnectivityManager, DEFAULT_AUTH_BASE_URL, DEFAULT_BASE_URL, DEFAULT_FN_HOST_SUFFIX, DbCache, DoubleRatchet, DoubleRatchetCipher, DoubleRatchetManager, EncryptedSession, EventCore, EventCoreEvents, Field, Field as FieldElement, FileStorage, FunctionsNamespace, HLC, HashKnowledge, HttpClient, HttpError, IndexedDbStore, KEEPER_MEMBER_ID, KeyStore, KeyringClient, KvCache, KvNamespace, LocalEngineHost, LocalStorageSessionStore, MemorySessionStore, Message, Message as MessageDefault, MessageNamespace, MuhkooAgent, MuhkooDB, MuhkooFunction, MuhkooSpace, NoopStore, OfflineLockedError, OfflineManager, OutboundQueue, P2P_SUBJECT, PBKDF2_DEFAULT_ITERATIONS, PREIMAGE_POK_VERIFICATION_KEY, Packet, PasskeyOriginError, PeerExchange, PeerNetwork, PersonalSpaceClient, Poseidon, PreimagePoK, ReedSolomonCodec, Space as Room, SerializeMessage, SessionState, ShardCache, ShardClient, SharedSpaceClient, SnapshotNamespace, Space, SpaceCache, SpaceKeyring, SpaceNamespace, SpacePacketCipher, SpaceSignaler, StorageNamespace, SyncEngine, VaultUnavailableError, WSTransport, WebRtcTransport, WorkerEngineHost, ZERO_HLC, ZkAuth, buildCommitment, compareHlc, compilePrograms, createPasskeyWithPrf, decodeFromHex, decorators, decryptAesGcm, defaultCircuitUrls, defaultRpId, defaultSessionStore, deleteBeatsWrite, deleteRegister, deriveAesKeyFromPassphrase, deriveBitsHkdf, deriveIdentity, deriveIdentityFromSeed, deriveMasterSeedFromPassword, ejectAgentPrompt, ejectAgentTools, emptyMap, emptyRegister, encodeToHex, encryptAesGcm, evaluatePasskeyPrf, exportPublicKeyBase64, exportPublicKeyHex, generateAuthProof, generatePkce, getMuhkooAppDescriptor, getSubtle, initBn128Wasm, initRsWasm, initializeCircuits, isNewer, isOfflineCapable, isP2pCapable, isProvisional, manifestToStat, materializeRow, mergeMap, mergeMessage, mergeRegister, messageKey, pack, padHandle, passkeyPrfCapable, passkeySupported, poseidonHash, protocol, provisionalHandle, quickVerify, randomBytes, randomState, rpIdUsableForOrigin, sealSeed, shardHash, signMessage, stableStringify, toField, tombstoneRow, unpack, unsealSeed, unwrapWithPassphrase, verify, verifyGroth16, verifyHashKnowledge, verifyPreimagePoK, wrapWithPassphrase, writeBeatsTombstone, writeColumns, writeRegister };
|
|
6023
|
+
export type { ACL, ACLEntry, AccessTokenInfo, AccessTokensNamespaceDeps, AgentConfig, AgentCreateInput, AgentDbToolMode, AgentProvisioned, AgentScopeOpts, AgentSkill, AgentToolsConfig, AgentTrigger, AgentTriggerType, AgentUpdateInput, AgentsNamespaceDeps, AttachedPeerNetwork, AuthClientOptions, AuthKeyPair, AuthSuccess, AuthToken, AuthType, AuthUser, BlockStore, Bn128WasmInstance, BroadcastChannelEvent, BroadcastChannelOptions, CachedSpaceMessage, ChannelLike, ChunkKeyMaterial, ChunkManifest, CipherFrame, CipherMessage, CipherMessageHeader, CircuitBufferConfig, CircuitUrls, ClientOptions, ConnectivityOptions, ConnectivityState, CreateAccessTokenInput, CreatedAccessToken, DbQueryPage, DehydratedKeypair, DehydratedKeys, DoubleRatchetCipherDeps, ECDHCurve, EncodeResult, EngineHandle, EngineHost, EphemeralEvent, EpochKeyProvider, FileManifest, FileNamespaceDeps, FileStat, FileStorageOptions, FunctionCaps, FunctionConfig, FunctionDeployInput, FunctionInvokeOptions, FunctionScopeOpts, FunctionTrigger, FunctionTriggerType, FunctionTriggers, FunctionUpdateInput, FunctionsNamespaceDeps, Groth16Proof, Hasher, HlcParts, HlcState, HttpClientOptions, IncomingFrame, KeyExchangeFrame, KeyPair, Keypair, KeyringClientDeps, KeyringTransport, KvEntry, KvNamespaceDeps, LoginOptions, LwwMap, LwwRegister, MessageBody, MessageDeletedEvent, MessageEntry, MessageEvent, MessageHeaders, MessageNamespaceDeps, MessageOp, MessageOptions, MessageSubscription, MuhkooAgentMeta, MuhkooAgentToolsConfig, MuhkooAppDescriptor, MuhkooDBAccess, MuhkooDBMeta, MuhkooFunctionMeta, MuhkooMessageEvent, MuhkooSpaceMeta, OAuthProvider, OfflineEntry, OfflineManagerDeps, OfflineStore, OutSink, PacketCipher, PacketHeaders, PacketOptions, Participant, PasskeyEnrollment, PeerBlockSource, PeerExchangeOptions, PeerId, PeerNetworkOptions, PeerTransport, Permission, PermissionCheckRequest, PermissionCheckResult, PersonalSpaceClientOptions, Pkce, PublicKeyJWK, QueueEntry, RatchetState, ReceiveResult, RegisterParams, Replayer, Role, SpaceDeps as RoomDeps, SpaceFileMetadata as RoomFileMetadata, Scope, SealedHandoff, SealedHeaders, Session, SessionOptions, SessionStore, SetOptions, ShardByteCache, ShardClientOptions, SharedSpaceClientOptions, SignalEnvelope, SignalKind, SignalingSpace, SnapshotNamespaceDeps, SnarkProof, SpaceChannelLike, SpaceCursor, SpaceDeps, SpaceFileMetadata, SpaceKeyCache, SpaceKeyringDeps, SpaceMessageEvent, SpaceNamespaceDeps, SpaceOfflineAdapter, StorageChangeEvent, StoreName, StoredSession, Subscription, UserIdentity, VaultFactor, VerificationKey, WSMessage, WSMessageType, WSTransportOptions, WebRtcTransportOptions, WrappedPayload, WriteFileInput, WriteFileOptions, WriteToShardsInput, ZkAuthDeps, ZkAuthenticateRequest, ZkChallengeResponse, ZkCompiled, ZkIdentity, ZkRegisterRequest, ZkRegisterResponse };
|
package/dist/server/index.js
CHANGED
|
@@ -2445,8 +2445,12 @@ class AuthClient {
|
|
|
2445
2445
|
* Read a factor record for `username` (returns an indistinguishable decoy if
|
|
2446
2446
|
* absent). Gated types (email) require the recover `verifyToken`.
|
|
2447
2447
|
*/
|
|
2448
|
-
async vaultRead(username, factorType, verifyToken
|
|
2449
|
-
|
|
2448
|
+
async vaultRead(username, factorType, verifyToken,
|
|
2449
|
+
/** Passkeys are per-origin: naming the caller's host returns THAT origin's
|
|
2450
|
+
* passkey instead of whichever was enrolled first (which WebAuthn would
|
|
2451
|
+
* refuse). Ignored for other factor types. */
|
|
2452
|
+
rpId) {
|
|
2453
|
+
const res = await this.fetchFn(`${this.baseUrl}/api/auth/vault`, this.json("POST", { username, factorType, verifyToken, rpId }));
|
|
2450
2454
|
return await this.parse("vaultRead", res);
|
|
2451
2455
|
}
|
|
2452
2456
|
/**
|
|
@@ -2976,7 +2980,7 @@ function base64UrlDecode(s) {
|
|
|
2976
2980
|
* expect (and isn't serving a stale cached bundle). Keep this in sync with
|
|
2977
2981
|
* `package.json` `version`.
|
|
2978
2982
|
*/
|
|
2979
|
-
const VERSION = "0.10.
|
|
2983
|
+
const VERSION = "0.10.11-alpha.0";
|
|
2980
2984
|
|
|
2981
2985
|
/**
|
|
2982
2986
|
* `HttpClient` — the one place the unified {@link Client} talks to the
|
|
@@ -3037,6 +3041,8 @@ class HttpClient {
|
|
|
3037
3041
|
/** Origin of {@link baseUrl} — credentials are only attached same-origin. */
|
|
3038
3042
|
baseOrigin;
|
|
3039
3043
|
apiKey;
|
|
3044
|
+
/** Scoped machine access token — takes precedence over {@link apiKey} on `X-Muhkoo-Key`. */
|
|
3045
|
+
accessToken;
|
|
3040
3046
|
getSessionToken;
|
|
3041
3047
|
onUnauthorized;
|
|
3042
3048
|
fetchFn;
|
|
@@ -3051,6 +3057,7 @@ class HttpClient {
|
|
|
3051
3057
|
this.baseOrigin = "";
|
|
3052
3058
|
}
|
|
3053
3059
|
this.apiKey = opts.apiKey ?? null;
|
|
3060
|
+
this.accessToken = opts.accessToken ?? null;
|
|
3054
3061
|
this.getSessionToken = opts.getSessionToken ?? (() => null);
|
|
3055
3062
|
this.onUnauthorized = opts.onUnauthorized ?? null;
|
|
3056
3063
|
const f = opts.fetch ?? globalThis.fetch;
|
|
@@ -3071,8 +3078,11 @@ class HttpClient {
|
|
|
3071
3078
|
// server-reflected path that escapes `baseUrl`) must NOT receive the app
|
|
3072
3079
|
// key or session token, or it becomes a token-exfiltration vector.
|
|
3073
3080
|
if (this.isSameOrigin(input)) {
|
|
3074
|
-
|
|
3075
|
-
|
|
3081
|
+
// Access token and app key resolve through the same accelerator path
|
|
3082
|
+
// and ride the same header; the access token takes precedence.
|
|
3083
|
+
const key = this.accessToken ?? this.apiKey;
|
|
3084
|
+
if (key)
|
|
3085
|
+
headers.set("X-Muhkoo-Key", key);
|
|
3076
3086
|
const token = this.getSessionToken();
|
|
3077
3087
|
if (token)
|
|
3078
3088
|
headers.set("X-Muhkoo-Session", token);
|
|
@@ -3486,6 +3496,35 @@ async function passkeyPrfCapable() {
|
|
|
3486
3496
|
function defaultRpId() {
|
|
3487
3497
|
return typeof location !== "undefined" ? location.hostname : "";
|
|
3488
3498
|
}
|
|
3499
|
+
/**
|
|
3500
|
+
* Can a passkey enrolled under `rpId` be used from the CURRENT origin?
|
|
3501
|
+
*
|
|
3502
|
+
* WebAuthn only accepts an RP id that is the origin's own host or a registrable
|
|
3503
|
+
* *parent* of it — so a passkey enrolled on `app.example.com` is unusable on
|
|
3504
|
+
* `app.example.net`, and one enrolled on a full host is unusable from a sibling
|
|
3505
|
+
* host. An app served on BOTH a custom domain and the platform host therefore
|
|
3506
|
+
* needs one passkey per origin.
|
|
3507
|
+
*
|
|
3508
|
+
* Call this BEFORE `navigator.credentials.get()`: passing a foreign rpId throws
|
|
3509
|
+
* a raw "The requested RPID did not match the origin or related origins", which
|
|
3510
|
+
* is a dead end for the user. Checking first lets the caller fall back to normal
|
|
3511
|
+
* sign-in (and offer to enroll a passkey for this origin) instead.
|
|
3512
|
+
*/
|
|
3513
|
+
function rpIdUsableForOrigin(rpId, host) {
|
|
3514
|
+
const h = host ?? (typeof location !== "undefined" ? location.hostname : "");
|
|
3515
|
+
if (!rpId || !h)
|
|
3516
|
+
return false;
|
|
3517
|
+
return h === rpId || h.endsWith(`.${rpId}`);
|
|
3518
|
+
}
|
|
3519
|
+
/** Thrown when the account's passkey belongs to a different origin. Callers
|
|
3520
|
+
* should treat this as "no passkey here" and fall back to another factor. */
|
|
3521
|
+
class PasskeyOriginError extends Error {
|
|
3522
|
+
code = "passkey_wrong_origin";
|
|
3523
|
+
constructor(message = "No passkey is enrolled for this site. Sign in another way, then add one for this device.") {
|
|
3524
|
+
super(message);
|
|
3525
|
+
this.name = "PasskeyOriginError";
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3489
3528
|
/**
|
|
3490
3529
|
* Create a passkey with PRF and return its credential id, a fresh PRF salt, and
|
|
3491
3530
|
* the PRF output for that salt. Throws if the authenticator can't do PRF.
|
|
@@ -4179,12 +4218,22 @@ class ZkAuth {
|
|
|
4179
4218
|
* its PRF, unwraps the master seed → identity → session.
|
|
4180
4219
|
*/
|
|
4181
4220
|
async loginWithPasskey(username, opts = {}) {
|
|
4182
|
-
|
|
4221
|
+
// Ask for THIS origin's passkey — they're enrolled per-origin, so the
|
|
4222
|
+
// account's first passkey may belong to a different host entirely.
|
|
4223
|
+
const host = defaultRpId();
|
|
4224
|
+
const { factor } = await this.deps.auth.vaultRead(username, "passkey", undefined, host);
|
|
4183
4225
|
const params = factor?.params;
|
|
4184
4226
|
if (!factor?.wrap || !factor?.iv || !params?.credentialId || !params?.prfSalt) {
|
|
4185
4227
|
throw new Error("No passkey is set up for this account.");
|
|
4186
4228
|
}
|
|
4187
|
-
const
|
|
4229
|
+
const rpId = params.rpId ?? host;
|
|
4230
|
+
// Refuse a foreign rpId up front: WebAuthn would throw a raw "requested
|
|
4231
|
+
// RPID did not match the origin", which reads as a hard failure to the
|
|
4232
|
+
// user. A typed error lets the app fall back to another factor and offer
|
|
4233
|
+
// to enroll a passkey for this origin.
|
|
4234
|
+
if (!rpIdUsableForOrigin(rpId, host))
|
|
4235
|
+
throw new PasskeyOriginError();
|
|
4236
|
+
const prfOutput = await evaluatePasskeyPrf(rpId, fromBase64(params.credentialId), fromBase64(params.prfSalt));
|
|
4188
4237
|
const key = await wrapKeyFromBytes(prfOutput, "muhkoo-passkey-wrap");
|
|
4189
4238
|
const seed = await unwrapSeed({ iv: factor.iv, ct: factor.wrap }, key);
|
|
4190
4239
|
const identity = await deriveIdentityFromSeed(seed);
|
|
@@ -4204,6 +4253,27 @@ class ZkAuth {
|
|
|
4204
4253
|
const { factors } = await this.deps.auth.vaultFactors(token);
|
|
4205
4254
|
return factors;
|
|
4206
4255
|
}
|
|
4256
|
+
/**
|
|
4257
|
+
* Is a passkey enrolled that can unlock from THIS origin?
|
|
4258
|
+
*
|
|
4259
|
+
* Passkeys are origin-bound, so an app served on both a custom domain and the
|
|
4260
|
+
* platform host needs one per host. Use this to decide whether to offer
|
|
4261
|
+
* "Unlock with passkey" or go straight to sign-in — prompting with another
|
|
4262
|
+
* origin's passkey fails with a raw WebAuthn error. Requires a session
|
|
4263
|
+
* (metadata read); returns false when signed out or unsupported.
|
|
4264
|
+
*/
|
|
4265
|
+
async hasPasskeyForThisOrigin() {
|
|
4266
|
+
if (!passkeySupported())
|
|
4267
|
+
return false;
|
|
4268
|
+
try {
|
|
4269
|
+
const host = defaultRpId();
|
|
4270
|
+
const factors = await this.listFactors();
|
|
4271
|
+
return factors.some((f) => f.type === "passkey" && rpIdUsableForOrigin(f.rpId, host));
|
|
4272
|
+
}
|
|
4273
|
+
catch {
|
|
4274
|
+
return false;
|
|
4275
|
+
}
|
|
4276
|
+
}
|
|
4207
4277
|
/** Remove a login method by id (can't remove your only one). Session-authed. */
|
|
4208
4278
|
async removeFactor(id) {
|
|
4209
4279
|
const token = this.deps.session.token;
|
|
@@ -9840,6 +9910,59 @@ class FunctionsNamespace {
|
|
|
9840
9910
|
}
|
|
9841
9911
|
}
|
|
9842
9912
|
|
|
9913
|
+
/**
|
|
9914
|
+
* `client.accessTokens` — manage an app's **access tokens**: scoped, expiring,
|
|
9915
|
+
* non-ZK machine-to-machine credentials (`mk_<env>_at_…`).
|
|
9916
|
+
*
|
|
9917
|
+
* const { plaintext } = await client.accessTokens.create(appId, {
|
|
9918
|
+
* scopes: ["db:read", "db:write"], env: "live", expiresInDays: 30,
|
|
9919
|
+
* label: "ci-runner",
|
|
9920
|
+
* });
|
|
9921
|
+
* // hand `plaintext` to the machine caller as its ClientOptions.accessToken
|
|
9922
|
+
*
|
|
9923
|
+
* These are MANAGEMENT calls — creating/listing/revoking tokens is authorized by
|
|
9924
|
+
* the developer session (same as the `agents`/`functions` namespaces). The token
|
|
9925
|
+
* itself resolves through the SAME accelerator path as an app key (the
|
|
9926
|
+
* `X-Muhkoo-Key` header), but is scoped to a fixed vocabulary of permissions and
|
|
9927
|
+
* expires. The plaintext is returned ONCE, on create — store it then; it can't
|
|
9928
|
+
* be read back.
|
|
9929
|
+
*/
|
|
9930
|
+
/** All valid {@link Scope}s, in canonical order. */
|
|
9931
|
+
const ACCESS_TOKEN_SCOPES = [
|
|
9932
|
+
"db:read",
|
|
9933
|
+
"db:write",
|
|
9934
|
+
"kv:read",
|
|
9935
|
+
"kv:write",
|
|
9936
|
+
"storage:read",
|
|
9937
|
+
"storage:write",
|
|
9938
|
+
"messages:read",
|
|
9939
|
+
"messages:write",
|
|
9940
|
+
"functions:invoke",
|
|
9941
|
+
"ai:infer",
|
|
9942
|
+
];
|
|
9943
|
+
class AccessTokensNamespace {
|
|
9944
|
+
deps;
|
|
9945
|
+
constructor(deps) {
|
|
9946
|
+
this.deps = deps;
|
|
9947
|
+
}
|
|
9948
|
+
/** List the app's access tokens (metadata only — never the plaintext). */
|
|
9949
|
+
async list(appId) {
|
|
9950
|
+
const res = await this.deps.http.get(this.path(appId, ""));
|
|
9951
|
+
return res.tokens ?? [];
|
|
9952
|
+
}
|
|
9953
|
+
/** Mint an access token (owner/editor only). The plaintext is returned once. */
|
|
9954
|
+
async create(appId, input) {
|
|
9955
|
+
return this.deps.http.post(this.path(appId, ""), input);
|
|
9956
|
+
}
|
|
9957
|
+
/** Revoke an access token by its `keyId`. */
|
|
9958
|
+
async revoke(appId, keyId) {
|
|
9959
|
+
return this.deps.http.del(this.path(appId, `/${encodeURIComponent(keyId)}`));
|
|
9960
|
+
}
|
|
9961
|
+
path(appId, suffix) {
|
|
9962
|
+
return `/api/apps/${encodeURIComponent(appId)}/access-tokens${suffix}`;
|
|
9963
|
+
}
|
|
9964
|
+
}
|
|
9965
|
+
|
|
9843
9966
|
/**
|
|
9844
9967
|
* `ChatKeyVault` — SDK-owned lifecycle for a member's long-lived ratchet/space
|
|
9845
9968
|
* keypair (the connect `KeyStore` entry keyed by the member id / username).
|
|
@@ -11087,6 +11210,8 @@ class Client {
|
|
|
11087
11210
|
agents;
|
|
11088
11211
|
/** Serverless functions — `client.functions.deploy(appId, …)`, etc. */
|
|
11089
11212
|
functions;
|
|
11213
|
+
/** Access tokens — `client.accessTokens.create(appId, …)`, etc. */
|
|
11214
|
+
accessTokens;
|
|
11090
11215
|
/** Offline cache + sync — `client.offline.status`, `client.offline.snapshot`, etc. */
|
|
11091
11216
|
offline;
|
|
11092
11217
|
session;
|
|
@@ -11140,6 +11265,7 @@ class Client {
|
|
|
11140
11265
|
this.http = new HttpClient({
|
|
11141
11266
|
baseUrl: this.baseUrl,
|
|
11142
11267
|
apiKey: options.apiKey,
|
|
11268
|
+
accessToken: options.accessToken,
|
|
11143
11269
|
getSessionToken: () => this.session.token,
|
|
11144
11270
|
fetch: reportingFetch,
|
|
11145
11271
|
// Self-heal stale sessions: on a 401, try a silent re-auth (only
|
|
@@ -11216,6 +11342,7 @@ class Client {
|
|
|
11216
11342
|
});
|
|
11217
11343
|
this.agents = new AgentsNamespace({ http: this.http });
|
|
11218
11344
|
this.functions = new FunctionsNamespace({ http: this.http, fnHostSuffix: options.functionsHostSuffix });
|
|
11345
|
+
this.accessTokens = new AccessTokensNamespace({ http: this.http });
|
|
11219
11346
|
// Replay deferred shard uploads on reconnect. The bytes live in the
|
|
11220
11347
|
// Cache API keyed by hash; re-PUT them through a (defer-free) shard
|
|
11221
11348
|
// client so a failure surfaces as transient and the entry stays queued.
|
|
@@ -11475,6 +11602,7 @@ function MuhkooDB(meta) {
|
|
|
11475
11602
|
table: meta.table ?? String(propertyKey),
|
|
11476
11603
|
access: meta.access ?? "read",
|
|
11477
11604
|
description: meta.description,
|
|
11605
|
+
backend: meta.backend ?? false,
|
|
11478
11606
|
});
|
|
11479
11607
|
});
|
|
11480
11608
|
}
|
|
@@ -11514,9 +11642,12 @@ function ejectAgentPrompt(appClass) {
|
|
|
11514
11642
|
for (const s of d.spaces)
|
|
11515
11643
|
lines.push(`- ${s.name}: ${s.description}`);
|
|
11516
11644
|
}
|
|
11517
|
-
|
|
11645
|
+
// Backend-only tables are deliberately withheld — the agent should never be
|
|
11646
|
+
// told about server-managed / internal state it can't (and shouldn't) touch.
|
|
11647
|
+
const promptTables = d.tables.filter((t) => !t.backend);
|
|
11648
|
+
if (promptTables.length) {
|
|
11518
11649
|
lines.push("", "App database tables:");
|
|
11519
|
-
for (const t of
|
|
11650
|
+
for (const t of promptTables) {
|
|
11520
11651
|
const verbs = t.access === "write"
|
|
11521
11652
|
? "read & write — db_query/db_get/db_insert/db_update/db_delete"
|
|
11522
11653
|
: "read-only — db_query/db_get";
|
|
@@ -11534,7 +11665,7 @@ function ejectAgentPrompt(appClass) {
|
|
|
11534
11665
|
// How to respond — the load-bearing behavioral contract. Without this, models
|
|
11535
11666
|
// (especially gpt-oss) tend to run tool calls and then end their turn with no
|
|
11536
11667
|
// user-facing message, so the user sees the work happen but gets no reply.
|
|
11537
|
-
const hasTools =
|
|
11668
|
+
const hasTools = promptTables.length > 0 || d.functions.length > 0;
|
|
11538
11669
|
lines.push("", "How to respond:");
|
|
11539
11670
|
if (hasTools) {
|
|
11540
11671
|
lines.push("- When you need information or need to make a change, call your tools immediately — don't ask the user to do it, and don't describe or name the tools to them.", "- After your tool calls return, you MUST send one final reply to the channel, in plain language, that answers the request using the results.");
|
|
@@ -12104,5 +12235,5 @@ var bundledLoader = /*#__PURE__*/Object.freeze({
|
|
|
12104
12235
|
default: loadRsWasm
|
|
12105
12236
|
});
|
|
12106
12237
|
|
|
12107
|
-
export { AES_GCM_IV_BYTES, AES_GCM_KEY_BYTES, AES_GCM_TAG_BYTES, AgentsNamespace, AuthClient, AuthNamespace, AuthPublicInput, Authenticator, BlockEngine, BroadcastChannel, BroadcastChannelEvents, ChannelExistsError, ChannelNotFoundError, ChunkCipher, Client, ConnectivityManager, DEFAULT_BASE_URL, DEFAULT_FN_HOST_SUFFIX, DbCache, DbNamespace, DbTable, DoubleRatchet, DoubleRatchetCipher, DoubleRatchetManager, EncryptedSession, EventCore, EventCoreEvents, Field, Field as FieldElement, FileStorage, FunctionsNamespace, HLC, HashKnowledge, HttpClient, HttpError, IndexedDbStore, KEEPER_MEMBER_ID, KeyStore, KeyringClient, KvCache, KvNamespace, LocalEngineHost, LocalStorageSessionStore, Logger, MemorySessionStore, Message, Message as MessageDefault, MessageNamespace, MuhkooAgent, MuhkooDB, MuhkooFunction, MuhkooSpace, NoopStore, OfflineLockedError, OfflineManager, OutboundQueue, P2P_SUBJECT, PBKDF2_DEFAULT_ITERATIONS, PREIMAGE_POK_VERIFICATION_KEY, Packet, PeerExchange, PeerNetwork, PersonalSpaceClient, Poseidon, PreimagePoK, Ready, ReedSolomonCodec, Retry, Space as Room, SerializeMessage, SessionState, ShardCache, ShardClient, SharedSpaceClient, SnapshotNamespace, Space, SpaceCache, SpaceKeyring, SpaceNamespace, SpacePacketCipher, SpaceSignaler, StorageNamespace, SyncEngine, VERSION, VaultUnavailableError, WSTransport, WebRtcTransport, WorkerEngineHost, ZERO_HLC, ZkAuth, _accountId, _formatBytes, _messageId, _objectId, _packetId, _socketId, _userId, appLogger$1 as appLogger, assertType, base58Decode, base58Encode, buildCommitment, compareHlc, compilePrograms, concatBytes, decodeFromHex, decorators, decryptAesGcm, defaultCircuitUrls, defaultSessionStore, deleteBeatsWrite, deleteRegister, deriveAesKeyFromPassphrase, deriveBitsHkdf, deriveIdentity, deriveIdentityFromSeed, deriveMasterSeedFromPassword, deserialize, ejectAgentPrompt, ejectAgentTools, emptyMap, emptyRegister, encodeToHex, encryptAesGcm, exportPublicKeyBase64, exportPublicKeyHex, fromBase64$1 as fromBase64, fromBase64Url, fromHex, generateAuthProof, generateChecksum, generateId, generatePkce, getIPAddress, getId, getMuhkooAppDescriptor, getSubtle, initBn128Wasm, initRsWasm, initializeCircuits, isNewer, isNumber, isOfflineCapable, isP2pCapable, isProvisional, log, manifestToStat, materializeRow, mergeMap, mergeMessage, mergeRegister, messageKey, pack, padHandle, poseidonHash, protocol, provisionalHandle, quickVerify, randomBytes, randomState, sealSeed, serialize, shardHash, signMessage, stableStringify, toBase64$1 as toBase64, toBase64Url, toField, toHex, tombstoneRow, unpack, unsealSeed, unwrapWithPassphrase, utf8Decode, utf8Encode, verify, verifyChecksum, verifyGroth16, verifyHashKnowledge, verifyPreimagePoK, wrapWithPassphrase, writeBeatsTombstone, writeColumns, writeRegister };
|
|
12238
|
+
export { ACCESS_TOKEN_SCOPES, AES_GCM_IV_BYTES, AES_GCM_KEY_BYTES, AES_GCM_TAG_BYTES, AccessTokensNamespace, AgentsNamespace, AuthClient, AuthNamespace, AuthPublicInput, Authenticator, BlockEngine, BroadcastChannel, BroadcastChannelEvents, ChannelExistsError, ChannelNotFoundError, ChunkCipher, Client, ConnectivityManager, DEFAULT_BASE_URL, DEFAULT_FN_HOST_SUFFIX, DbCache, DbNamespace, DbTable, DoubleRatchet, DoubleRatchetCipher, DoubleRatchetManager, EncryptedSession, EventCore, EventCoreEvents, Field, Field as FieldElement, FileStorage, FunctionsNamespace, HLC, HashKnowledge, HttpClient, HttpError, IndexedDbStore, KEEPER_MEMBER_ID, KeyStore, KeyringClient, KvCache, KvNamespace, LocalEngineHost, LocalStorageSessionStore, Logger, MemorySessionStore, Message, Message as MessageDefault, MessageNamespace, MuhkooAgent, MuhkooDB, MuhkooFunction, MuhkooSpace, NoopStore, OfflineLockedError, OfflineManager, OutboundQueue, P2P_SUBJECT, PBKDF2_DEFAULT_ITERATIONS, PREIMAGE_POK_VERIFICATION_KEY, Packet, PasskeyOriginError, PeerExchange, PeerNetwork, PersonalSpaceClient, Poseidon, PreimagePoK, Ready, ReedSolomonCodec, Retry, Space as Room, SerializeMessage, SessionState, ShardCache, ShardClient, SharedSpaceClient, SnapshotNamespace, Space, SpaceCache, SpaceKeyring, SpaceNamespace, SpacePacketCipher, SpaceSignaler, StorageNamespace, SyncEngine, VERSION, VaultUnavailableError, WSTransport, WebRtcTransport, WorkerEngineHost, ZERO_HLC, ZkAuth, _accountId, _formatBytes, _messageId, _objectId, _packetId, _socketId, _userId, appLogger$1 as appLogger, assertType, base58Decode, base58Encode, buildCommitment, compareHlc, compilePrograms, concatBytes, decodeFromHex, decorators, decryptAesGcm, defaultCircuitUrls, defaultSessionStore, deleteBeatsWrite, deleteRegister, deriveAesKeyFromPassphrase, deriveBitsHkdf, deriveIdentity, deriveIdentityFromSeed, deriveMasterSeedFromPassword, deserialize, ejectAgentPrompt, ejectAgentTools, emptyMap, emptyRegister, encodeToHex, encryptAesGcm, exportPublicKeyBase64, exportPublicKeyHex, fromBase64$1 as fromBase64, fromBase64Url, fromHex, generateAuthProof, generateChecksum, generateId, generatePkce, getIPAddress, getId, getMuhkooAppDescriptor, getSubtle, initBn128Wasm, initRsWasm, initializeCircuits, isNewer, isNumber, isOfflineCapable, isP2pCapable, isProvisional, log, manifestToStat, materializeRow, mergeMap, mergeMessage, mergeRegister, messageKey, pack, padHandle, poseidonHash, protocol, provisionalHandle, quickVerify, randomBytes, randomState, rpIdUsableForOrigin, sealSeed, serialize, shardHash, signMessage, stableStringify, toBase64$1 as toBase64, toBase64Url, toField, toHex, tombstoneRow, unpack, unsealSeed, unwrapWithPassphrase, utf8Decode, utf8Encode, verify, verifyChecksum, verifyGroth16, verifyHashKnowledge, verifyPreimagePoK, wrapWithPassphrase, writeBeatsTombstone, writeColumns, writeRegister };
|
|
12108
12239
|
//# sourceMappingURL=index.js.map
|