@jini-ai/daemon 0.3.8 → 0.5.1
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 +124 -0
- package/README.md +50 -8
- package/dist/agent-executor/contracts.d.ts +736 -0
- package/dist/agent-executor/contracts.js +28 -0
- package/dist/agent-executor/event-translation.d.ts +87 -0
- package/dist/agent-executor/event-translation.js +230 -0
- package/dist/agent-executor/events.d.ts +190 -0
- package/dist/agent-executor/events.js +848 -0
- package/dist/agent-executor/handoff.d.ts +18 -0
- package/dist/agent-executor/handoff.js +16 -0
- package/dist/agent-executor/index.d.ts +98 -0
- package/dist/agent-executor/index.js +98 -0
- package/dist/agent-executor/launch.d.ts +375 -0
- package/dist/agent-executor/launch.js +1001 -0
- package/dist/agent-executor/mcp-bridge.d.ts +338 -0
- package/dist/agent-executor/mcp-bridge.js +835 -0
- package/dist/agent-executor/values.d.ts +5 -0
- package/dist/agent-executor/values.js +13 -0
- package/dist/agent-executor.d.ts +375 -176
- package/dist/agent-executor.js +388 -335
- package/dist/close-status.d.ts +11 -8
- package/dist/close-status.js +31 -19
- package/dist/continuation/continuation-transport.d.ts +3 -1
- package/dist/continuation/continuation-transport.js +1 -1
- package/dist/continuation/journal.d.ts +12 -5
- package/dist/continuation/journal.js +4 -4
- package/dist/continuation/run-scoped-context-store.d.ts +13 -4
- package/dist/continuation/run-scoped-context-store.js +6 -6
- package/dist/continuation/run-start-handler.d.ts +1 -1
- package/dist/continuation/run-start-handler.js +3 -16
- package/dist/delegated-tool-bridge.d.ts +7 -3
- package/dist/delegated-tool-bridge.js +32 -31
- package/dist/event-log.d.ts +7 -5
- package/dist/event-log.js +12 -11
- package/dist/frontend-capability-tools.d.ts +1 -1
- package/dist/frontend-capability-tools.js +3 -2
- package/dist/frontend-session-registry.d.ts +32 -9
- package/dist/frontend-session-registry.js +12 -11
- package/dist/http/active-context.d.ts +105 -0
- package/dist/http/active-context.js +67 -0
- package/dist/http/agents.d.ts +68 -0
- package/dist/http/agents.js +12 -0
- package/dist/http/attachments.d.ts +618 -0
- package/dist/http/attachments.js +1034 -0
- package/dist/http/cancel-owned-runs.d.ts +49 -0
- package/dist/http/cancel-owned-runs.js +35 -0
- package/dist/http/component-catalog.d.ts +84 -0
- package/dist/http/component-catalog.js +64 -0
- package/dist/http/connectors.d.ts +209 -0
- package/dist/http/connectors.js +409 -0
- package/dist/http/daemon-status.d.ts +76 -0
- package/dist/http/daemon-status.js +55 -0
- package/dist/http/db-ops.d.ts +123 -0
- package/dist/http/db-ops.js +189 -0
- package/dist/http/delegated-tools.d.ts +113 -0
- package/dist/http/delegated-tools.js +230 -0
- package/dist/http/frontend-control.d.ts +136 -0
- package/dist/http/frontend-control.js +79 -0
- package/dist/http/frontend-sessions.d.ts +110 -0
- package/dist/http/frontend-sessions.js +180 -0
- package/dist/http/health.d.ts +95 -0
- package/dist/http/health.js +40 -0
- package/dist/http/host-tools.d.ts +214 -0
- package/dist/http/host-tools.js +329 -0
- package/dist/http/index.d.ts +52 -0
- package/dist/http/index.js +27 -0
- package/dist/http/media.d.ts +146 -0
- package/dist/http/media.js +346 -0
- package/dist/http/memory.d.ts +265 -0
- package/dist/http/memory.js +328 -0
- package/dist/http/model-proxy.d.ts +49 -0
- package/dist/http/model-proxy.js +642 -0
- package/dist/http/remote-run-events.d.ts +70 -0
- package/dist/http/remote-run-events.js +224 -0
- package/dist/http/research.d.ts +48 -0
- package/dist/http/research.js +315 -0
- package/dist/http/route-manifest.d.ts +35 -0
- package/dist/http/route-manifest.js +103 -0
- package/dist/http/routines.d.ts +120 -0
- package/dist/http/routines.js +298 -0
- package/dist/http/run-credentials.d.ts +73 -0
- package/dist/http/run-credentials.js +71 -0
- package/dist/http/runs.d.ts +91 -0
- package/dist/http/runs.js +221 -0
- package/dist/http/terminals.d.ts +138 -0
- package/dist/http/terminals.js +325 -0
- package/dist/http/tool-catalog.d.ts +78 -0
- package/dist/http/tool-catalog.js +66 -0
- package/dist/http/workspace-root.d.ts +77 -0
- package/dist/http/workspace-root.js +63 -0
- package/dist/http/xai.d.ts +90 -0
- package/dist/http/xai.js +655 -0
- package/dist/image-prompt-delivery.d.ts +13 -3
- package/dist/image-prompt-delivery.js +5 -5
- package/dist/index.d.ts +556 -4
- package/dist/index.js +556 -4
- package/dist/legacy-data-migration.d.ts +59 -8
- package/dist/legacy-data-migration.js +38 -33
- package/dist/read-only-tools.d.ts +130 -0
- package/dist/read-only-tools.js +115 -0
- package/dist/remote-tool-bridge.d.ts +11 -5
- package/dist/remote-tool-bridge.js +15 -15
- package/dist/routines/index.d.ts +1 -1
- package/dist/routines/index.js +1 -1
- package/dist/routines/routine-store.d.ts +34 -12
- package/dist/routines/routine-store.js +21 -20
- package/dist/routines/schedule.d.ts +48 -10
- package/dist/routines/schedule.js +21 -21
- package/dist/routines/scheduler.d.ts +32 -11
- package/dist/routines/scheduler.js +61 -57
- package/dist/routines/types.d.ts +10 -3
- package/dist/run/core/result.d.ts +6 -2
- package/dist/run/core/result.js +3 -3
- package/dist/run/core/retry.d.ts +17 -4
- package/dist/run/core/retry.js +7 -11
- package/dist/run/diagnostics/diagnostics.d.ts +14 -4
- package/dist/run/diagnostics/diagnostics.js +7 -7
- package/dist/run/index.d.ts +1 -1
- package/dist/run/index.js +1 -1
- package/dist/run-credentials.d.ts +138 -0
- package/dist/run-credentials.js +152 -0
- package/dist/run-lifecycle.d.ts +92 -33
- package/dist/run-lifecycle.js +81 -74
- package/dist/scheduler.d.ts +8 -0
- package/dist/scheduler.js +2 -0
- package/dist/session-coordination.d.ts +115 -0
- package/dist/session-coordination.js +111 -0
- package/dist/store/agent-sessions/errors.d.ts +8 -0
- package/dist/store/agent-sessions/errors.js +10 -0
- package/dist/store/agent-sessions/index.d.ts +12 -0
- package/dist/store/agent-sessions/index.js +19 -0
- package/dist/store/agent-sessions/pglite.d.ts +12 -0
- package/dist/store/agent-sessions/pglite.js +7 -0
- package/dist/store/agent-sessions/ports.d.ts +24 -0
- package/dist/store/agent-sessions/ports.js +2 -0
- package/dist/store/agent-sessions/postgres.d.ts +12 -0
- package/dist/store/agent-sessions/postgres.js +7 -0
- package/dist/store/agent-sessions/schema.d.ts +3 -0
- package/dist/store/agent-sessions/schema.js +23 -0
- package/dist/store/agent-sessions/sql.d.ts +35 -0
- package/dist/store/agent-sessions/sql.js +59 -0
- package/dist/store/agent-sessions/sqlite.d.ts +117 -0
- package/dist/store/agent-sessions/sqlite.js +128 -0
- package/dist/store/event-log/sqlite.d.ts +75 -0
- package/dist/store/event-log/sqlite.js +230 -0
- package/dist/surface-exchanges.d.ts +97 -0
- package/dist/surface-exchanges.js +153 -0
- package/dist/terminal-session.d.ts +43 -11
- package/dist/terminal-session.js +22 -20
- package/dist/tokens.js +4 -4
- package/dist/tool-audit.d.ts +114 -0
- package/dist/tool-audit.js +95 -0
- package/dist/tool-executor.d.ts +22 -7
- package/dist/tool-executor.js +16 -16
- package/dist/tool-result-media.d.ts +3 -1
- package/dist/tool-result-media.js +1 -1
- package/dist/tool-result-surfaces.d.ts +3 -1
- package/dist/tool-result-surfaces.js +1 -1
- package/package.json +127 -9
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { Express } from 'express';
|
|
2
|
+
import { PendingAuthCache, startOAuthCallbackListener, type OAuthCallbackListener, type OAuthPkceProviderConfig } from '@jini-ai/agent-runtime';
|
|
3
|
+
import { type AdapterContext } from '@jini-ai/http-kit';
|
|
4
|
+
export interface XaiInternalErrorContext {
|
|
5
|
+
readonly source: 'oauth-start' | 'oauth-complete' | 'oauth-disconnect' | 'auth-status' | 'search';
|
|
6
|
+
readonly correlationId: string;
|
|
7
|
+
readonly error: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface XaiHttpDeps {
|
|
10
|
+
/** Directory the xAI OAuth token is persisted under (`<dataDir>/<tokenFileName>`). Defaults to `process.cwd()` — a host with a real dataDir should override this (matching `create-local-node-daemon.ts`'s `memoryRoutesDeps.dataDir` pattern). */
|
|
11
|
+
readonly dataDir?: string;
|
|
12
|
+
/** On-disk file name for the stored token, scoped under `dataDir`. Defaults to `xai-oauth-token.json`. */
|
|
13
|
+
readonly tokenFileName?: string;
|
|
14
|
+
/** The OAuth+PKCE provider config to drive the dance against. Defaults to `@jini-ai/agent-runtime`'s real `XAI_OAUTH_PROVIDER_CONFIG` preset — override only to point at a different client_id/issuer (e.g. once a non-PoC xAI client_id is provisioned). */
|
|
15
|
+
readonly providerConfig?: OAuthPkceProviderConfig;
|
|
16
|
+
/** Loopback callback host `providerConfig.clientId` is registered against. Defaults to `XAI_OAUTH_REDIRECT_HOST` (`127.0.0.1`) — see module doc on why this is fixed for xAI's PoC client_id. */
|
|
17
|
+
readonly callbackHost?: string;
|
|
18
|
+
/** Loopback callback port `providerConfig.clientId` is registered against. Defaults to `XAI_OAUTH_REDIRECT_PORT` (`56121`). */
|
|
19
|
+
readonly callbackPort?: number;
|
|
20
|
+
/** Loopback callback path `providerConfig.clientId` is registered against. Defaults to `XAI_OAUTH_REDIRECT_PATH` (`/callback`). */
|
|
21
|
+
readonly callbackPath?: string;
|
|
22
|
+
/** In-memory pending-authorization cache backing the begin/complete dance. Defaults to a fresh 30-minute `PendingAuthCache`, shared across every request `registerXaiRoutes` mounts — see module doc on why this must be resolved once, not per-call. */
|
|
23
|
+
readonly pending?: PendingAuthCache;
|
|
24
|
+
/** Mutable slot holding the in-flight loopback listener, if any (only one OAuth dance can be in flight at a time — the port is a singleton). Shared the same way `pending` is. Defaults to `{ current: null }`. */
|
|
25
|
+
readonly listenerRef?: {
|
|
26
|
+
current: OAuthCallbackListener | null;
|
|
27
|
+
};
|
|
28
|
+
/** Opens the loopback callback listener. Defaults to `@jini-ai/agent-runtime`'s `startOAuthCallbackListener`. Overridable so tests never bind a real socket. */
|
|
29
|
+
readonly startCallbackListener?: typeof startOAuthCallbackListener;
|
|
30
|
+
/** Base URL for xAI's Responses API (`POST {searchBaseUrl}/responses`). Defaults to `https://api.x.ai/v1`. */
|
|
31
|
+
readonly searchBaseUrl?: string;
|
|
32
|
+
/** Model id sent to the Responses API when a search request doesn't supply its own. Defaults to xAI's real `grok-4.20-reasoning`. */
|
|
33
|
+
readonly searchDefaultModel?: string;
|
|
34
|
+
readonly fetchImpl?: typeof fetch;
|
|
35
|
+
/** Deadline for one search request *and* its response body, in milliseconds. Defaults to {@link DEFAULT_SEARCH_TIMEOUT_MS}. */
|
|
36
|
+
readonly searchTimeoutMs?: number;
|
|
37
|
+
/** Host-owned sink for the real exception behind a generic `INTERNAL_ERROR` response (SEC-005). Defaults to `console.error`. */
|
|
38
|
+
readonly onInternalError?: (context: XaiInternalErrorContext) => void;
|
|
39
|
+
}
|
|
40
|
+
export interface XaiOauthStartResponse {
|
|
41
|
+
readonly authorizeUrl: string;
|
|
42
|
+
readonly state: string;
|
|
43
|
+
readonly callback: {
|
|
44
|
+
readonly host: string;
|
|
45
|
+
readonly port: number;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export declare const xaiOauthStartRoute: import("@jini-ai/http-kit").JsonRouteSpec<void, XaiOauthStartResponse, XaiHttpDeps>;
|
|
49
|
+
export interface XaiOkResponse {
|
|
50
|
+
readonly ok: true;
|
|
51
|
+
}
|
|
52
|
+
interface XaiOauthCompleteRequest {
|
|
53
|
+
readonly state: string;
|
|
54
|
+
readonly code: string;
|
|
55
|
+
}
|
|
56
|
+
export declare const xaiOauthCompleteRoute: import("@jini-ai/http-kit").JsonRouteSpec<XaiOauthCompleteRequest, XaiOkResponse, XaiHttpDeps>;
|
|
57
|
+
export declare const xaiOauthCancelRoute: import("@jini-ai/http-kit").JsonRouteSpec<void, XaiOkResponse, XaiHttpDeps>;
|
|
58
|
+
export interface XaiAuthStatusResponse {
|
|
59
|
+
readonly connected: boolean;
|
|
60
|
+
readonly expiresAt: number | null;
|
|
61
|
+
readonly scope: string | null;
|
|
62
|
+
readonly savedAt: number | null;
|
|
63
|
+
readonly listening: boolean;
|
|
64
|
+
}
|
|
65
|
+
export declare const xaiAuthStatusRoute: import("@jini-ai/http-kit").JsonRouteSpec<void, XaiAuthStatusResponse, XaiHttpDeps>;
|
|
66
|
+
export declare const xaiOauthDisconnectRoute: import("@jini-ai/http-kit").JsonRouteSpec<void, XaiOkResponse, XaiHttpDeps>;
|
|
67
|
+
interface XaiSearchRequest {
|
|
68
|
+
readonly query: string;
|
|
69
|
+
readonly allowedXHandles?: readonly string[];
|
|
70
|
+
readonly excludedXHandles?: readonly string[];
|
|
71
|
+
readonly fromDate?: string;
|
|
72
|
+
readonly toDate?: string;
|
|
73
|
+
readonly enableImageUnderstanding?: boolean;
|
|
74
|
+
readonly enableVideoUnderstanding?: boolean;
|
|
75
|
+
readonly model?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface XaiSearchResponse {
|
|
78
|
+
readonly answer: string;
|
|
79
|
+
readonly citations: readonly string[];
|
|
80
|
+
readonly model: string;
|
|
81
|
+
}
|
|
82
|
+
export declare const xaiSearchRoute: import("@jini-ai/http-kit").JsonRouteSpec<XaiSearchRequest, XaiSearchResponse, XaiHttpDeps>;
|
|
83
|
+
/** Mounts every xAI route on `app`. A pack's `http(app, services)` calls this directly. */
|
|
84
|
+
export declare function registerXaiRoutes({ app, deps, adapter }: {
|
|
85
|
+
readonly app: Express;
|
|
86
|
+
readonly deps: XaiHttpDeps;
|
|
87
|
+
readonly adapter: AdapterContext;
|
|
88
|
+
}, _optional?: Record<string, never>): void;
|
|
89
|
+
export {};
|
|
90
|
+
//# sourceMappingURL=xai.d.ts.map
|