@sentry/junior 0.109.0 → 0.111.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/{agent-hooks-FHHVLNPA.js → agent-hooks-QQ2IWKOP.js} +12 -13
- package/dist/api/conversations/access.d.ts +9 -0
- package/dist/api/conversations/aggregate.d.ts +12 -1
- package/dist/api/conversations/archive.d.ts +3 -5
- package/dist/api/conversations/detail.d.ts +156 -7
- package/dist/api/conversations/events.d.ts +1 -1
- package/dist/api/conversations/list.d.ts +57 -6
- package/dist/api/conversations/projection.d.ts +6 -7
- package/dist/api/conversations/reporting.d.ts +10 -4
- package/dist/api/conversations/routes.d.ts +2 -1
- package/dist/api/conversations/shared.d.ts +1 -1
- package/dist/api/conversations/stats.d.ts +37 -6
- package/dist/api/conversations/stats.query.d.ts +1 -1
- package/dist/api/conversations/usage.d.ts +9 -0
- package/dist/api/http.d.ts +7 -0
- package/dist/api/locations/detail.d.ts +102 -6
- package/dist/api/locations/list.d.ts +43 -5
- package/dist/api/locations/query.d.ts +4 -2
- package/dist/api/locations/routes.d.ts +2 -1
- package/dist/api/people/list.d.ts +28 -6
- package/dist/api/people/list.query.d.ts +1 -1
- package/dist/api/people/profile.d.ts +96 -7
- package/dist/api/people/profile.query.d.ts +4 -2
- package/dist/api/people/routes.d.ts +2 -1
- package/dist/api/people/shared.d.ts +1219 -2
- package/dist/api/route.d.ts +18 -4
- package/dist/api/schema/common.d.ts +6 -0
- package/dist/api/{conversations/schema.d.ts → schema/conversation.d.ts} +31 -3
- package/dist/api/{locations/schema.d.ts → schema/location.d.ts} +5 -0
- package/dist/api/{people/schema.d.ts → schema/person.d.ts} +37 -45
- package/dist/api/schema.d.ts +8 -22
- package/dist/api/schema.js +10 -2
- package/dist/api.d.ts +5 -1
- package/dist/api.js +767 -384
- package/dist/app.js +591 -447
- package/dist/build/virtual-config.d.ts +2 -0
- package/dist/catalog-runtime-D22W6QEJ.js +16 -0
- package/dist/chat/agent/request.d.ts +3 -6
- package/dist/chat/agent/resume.d.ts +11 -12
- package/dist/chat/agent/sandbox.d.ts +36 -11
- package/dist/chat/agent/tools.d.ts +5 -8
- package/dist/chat/config.d.ts +8 -1
- package/dist/chat/conversations/history.d.ts +3 -0
- package/dist/chat/conversations/sql/privacy.d.ts +3 -15
- package/dist/chat/pi/messages.d.ts +2 -2
- package/dist/chat/pi/sdk.d.ts +1 -1
- package/dist/chat/pi/sql-model-usage.d.ts +4 -1
- package/dist/chat/plugins/agent-hooks.d.ts +2 -2
- package/dist/chat/runtime/agent-continue-runner.d.ts +7 -3
- package/dist/chat/runtime/slack-runtime.d.ts +1 -2
- package/dist/chat/runtime/thread-state.d.ts +3 -7
- package/dist/chat/runtime/turn-preparation.d.ts +2 -2
- package/dist/chat/sandbox/command-result.d.ts +91 -0
- package/dist/chat/sandbox/errors.d.ts +3 -1
- package/dist/chat/sandbox/ref.d.ts +5 -0
- package/dist/chat/sandbox/sandbox.d.ts +19 -46
- package/dist/chat/sandbox/session.d.ts +16 -20
- package/dist/chat/sandbox/skill-sync.d.ts +2 -2
- package/dist/chat/sandbox/workspace.d.ts +14 -12
- package/dist/chat/services/auth-pause.d.ts +4 -0
- package/dist/chat/services/context-compaction.d.ts +1 -0
- package/dist/chat/services/turn-result.d.ts +3 -4
- package/dist/chat/task-execution/queue-signing.d.ts +10 -8
- package/dist/chat/task-execution/queue.d.ts +9 -7
- package/dist/chat/task-execution/slack-work.d.ts +9 -7
- package/dist/chat/task-execution/state.d.ts +75 -22
- package/dist/chat/task-execution/store.d.ts +34 -3
- package/dist/chat/task-execution/worker.d.ts +0 -1
- package/dist/chat/tool-support/normalize-result.d.ts +2 -2
- package/dist/chat/tool-support/pi-tool-adapter.d.ts +2 -2
- package/dist/chat/tool-support/structured-result.d.ts +1 -2
- package/dist/chat/tools/sandbox/file-uploads.d.ts +1 -1
- package/dist/chat/{runtime → tools/sandbox}/generated-artifacts.d.ts +3 -3
- package/dist/chat/tools/types.d.ts +1 -1
- package/dist/chat/tools/web/fetch-content.d.ts +5 -0
- package/dist/chat/tools/web/image-generate.d.ts +2 -1
- package/dist/chat/tools/web/search.d.ts +1 -1
- package/dist/{chunk-CEA3A3UA.js → chunk-2ZTTXTSZ.js} +24 -1
- package/dist/{chunk-IVVGFRQQ.js → chunk-42WRQLJ6.js} +10 -38
- package/dist/{chunk-O3JMSZLI.js → chunk-6Y5L4BOM.js} +3 -5
- package/dist/{chunk-HO5NT6OE.js → chunk-B45FPP2A.js} +306 -31
- package/dist/{chunk-WHMOBKT7.js → chunk-BTRNMS6A.js} +2 -2
- package/dist/{chunk-PLB7MRCQ.js → chunk-C4MZ3GP5.js} +1 -1
- package/dist/{chunk-HHVY4SMP.js → chunk-FPK7XY3F.js} +98 -92
- package/dist/{chunk-RGX4V75M.js → chunk-IFAHK54X.js} +3 -3
- package/dist/{chunk-ISMWX44P.js → chunk-J7APPQIJ.js} +2 -2
- package/dist/{chunk-TMBRFULF.js → chunk-JQFJO5WH.js} +7 -1
- package/dist/{chunk-FWJRXN4F.js → chunk-L6JPKANW.js} +3 -139
- package/dist/{chunk-7Q6WCISF.js → chunk-MIAKQNYX.js} +43 -31
- package/dist/chunk-MPVES2IC.js +44 -0
- package/dist/{chunk-JNAVF45E.js → chunk-NQLWOTY4.js} +47 -19
- package/dist/{chunk-IXKSQGIO.js → chunk-OOLU34J4.js} +8860 -9137
- package/dist/{chunk-OUHNWH46.js → chunk-PYKKM4MM.js} +1 -1
- package/dist/{chunk-MXW4GL53.js → chunk-PZELBSHC.js} +8 -9
- package/dist/{chunk-QY636HZU.js → chunk-QQIVLZW4.js} +96 -17
- package/dist/{chunk-72OMGPDS.js → chunk-SL3ZKNLQ.js} +19 -18
- package/dist/{chunk-3SXUV423.js → chunk-WSRBFHPX.js} +1 -1
- package/dist/{chunk-TT6GMXNA.js → chunk-XQAYFRWT.js} +2 -2
- package/dist/{chunk-MGUMR35T.js → chunk-Z2W4SJZ7.js} +1 -1
- package/dist/{chunk-OCD3OZRK.js → chunk-Z4G3WCP3.js} +1 -1
- package/dist/{chunk-FENLIFJD.js → chunk-ZRZ4SVWG.js} +69 -10
- package/dist/cli/chat.js +23 -24
- package/dist/cli/check.js +8 -8
- package/dist/cli/plugins.js +15 -16
- package/dist/cli/snapshot-warmup.js +11 -11
- package/dist/cli/upgrade.js +9 -9
- package/dist/db/schema/conversations.d.ts +17 -0
- package/dist/db/schema.d.ts +17 -0
- package/dist/{db-V3NU72O2.js → db-WXQOQESG.js} +8 -9
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +15 -10
- package/dist/reporting-schema.d.ts +46 -0
- package/dist/{runner-JYBCQBLK.js → runner-4QY4XH4B.js} +23 -33
- package/dist/{skills-U6MDAST7.js → skills-P5MU4EBX.js} +8 -8
- package/dist/{validation-72N3JVRU.js → validation-PQF5OP6T.js} +8 -8
- package/dist/version.js +1 -1
- package/migrations/0007_thick_sugar_man.sql +23 -0
- package/migrations/meta/0007_snapshot.json +1013 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +6 -6
- package/dist/catalog-runtime-DMGJSLV2.js +0 -16
- package/dist/chunk-OB42YVAE.js +0 -16
- package/dist/chunk-SYAQIR5Z.js +0 -53
|
@@ -8,6 +8,7 @@ export interface RuntimePluginModule {
|
|
|
8
8
|
}
|
|
9
9
|
/** Render the virtual config module consumed by createApp(). */
|
|
10
10
|
export declare function renderVirtualConfig(options: {
|
|
11
|
+
functionMaxDurationSeconds?: number;
|
|
11
12
|
dashboard?: JuniorDashboardOptions;
|
|
12
13
|
plugins?: PluginCatalogConfig;
|
|
13
14
|
pluginModule?: RuntimePluginModule;
|
|
@@ -15,6 +16,7 @@ export declare function renderVirtualConfig(options: {
|
|
|
15
16
|
}): string;
|
|
16
17
|
/** Inject a virtual module so createApp() can read the plugin list at runtime. */
|
|
17
18
|
export declare function injectVirtualConfig(nitro: Nitro, options?: {
|
|
19
|
+
functionMaxDurationSeconds?: number;
|
|
18
20
|
loadPluginSet?: () => Promise<JuniorPluginSet | undefined>;
|
|
19
21
|
pluginModule?: RuntimePluginModule;
|
|
20
22
|
plugins?: PluginCatalogConfig;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
pluginCatalogRuntime
|
|
3
|
+
} from "./chunk-WSRBFHPX.js";
|
|
4
|
+
import "./chunk-XQAYFRWT.js";
|
|
5
|
+
import "./chunk-C4MZ3GP5.js";
|
|
6
|
+
import "./chunk-J7APPQIJ.js";
|
|
7
|
+
import "./chunk-42WRQLJ6.js";
|
|
8
|
+
import "./chunk-6GWA276C.js";
|
|
9
|
+
import "./chunk-B3IT5END.js";
|
|
10
|
+
import "./chunk-3V7OFJZC.js";
|
|
11
|
+
import "./chunk-MPVES2IC.js";
|
|
12
|
+
import "./chunk-Z4G3WCP3.js";
|
|
13
|
+
import "./chunk-MLKGABMK.js";
|
|
14
|
+
export {
|
|
15
|
+
pluginCatalogRuntime
|
|
16
|
+
};
|
|
@@ -13,7 +13,7 @@ import type { ConversationPrivacy } from "@/chat/conversation-privacy";
|
|
|
13
13
|
import type { CredentialContext } from "@/chat/credentials/context";
|
|
14
14
|
import type { PiMessage } from "@/chat/pi/messages";
|
|
15
15
|
import type { Actor } from "@/chat/actor";
|
|
16
|
-
import type {
|
|
16
|
+
import type { SandboxRef } from "@/chat/sandbox/ref";
|
|
17
17
|
import type { SandboxEgressTracePropagationConfig } from "@/chat/sandbox/egress/tracing";
|
|
18
18
|
import type { AuthorizationFlowMode } from "@/chat/services/auth-pause";
|
|
19
19
|
import type { AssistantStatusSpec } from "@/chat/slack/assistant-thread/status";
|
|
@@ -105,10 +105,7 @@ export interface AgentRunState {
|
|
|
105
105
|
artifactState?: ThreadArtifactsState;
|
|
106
106
|
pendingAuth?: ConversationPendingAuthState;
|
|
107
107
|
/** Persisted sandbox reuse state from prior slices of this conversation. */
|
|
108
|
-
|
|
109
|
-
sandboxId?: string;
|
|
110
|
-
sandboxDependencyProfileHash?: string;
|
|
111
|
-
};
|
|
108
|
+
sandboxRef?: SandboxRef;
|
|
112
109
|
}
|
|
113
110
|
/**
|
|
114
111
|
* Carries notification-only callbacks for streaming UI and status surfaces;
|
|
@@ -142,7 +139,7 @@ export interface AgentRunDurability {
|
|
|
142
139
|
shouldYield?: () => boolean;
|
|
143
140
|
drainSteeringMessages?: (accept: (messages: AgentRunSteeringMessage[]) => Promise<void>) => Promise<AgentRunSteeringMessage[]>;
|
|
144
141
|
recordPendingAuth?: (pendingAuth: ConversationPendingAuthState | undefined) => void | Promise<void>;
|
|
145
|
-
|
|
142
|
+
onSandboxRefChanged?: (sandboxRef: SandboxRef) => void | Promise<void>;
|
|
146
143
|
onArtifactStateUpdated?: (artifactState: ThreadArtifactsState) => void | Promise<void>;
|
|
147
144
|
}
|
|
148
145
|
/** Groups the per-slice run request by the runtime role each field serves. */
|
|
@@ -15,6 +15,7 @@ import type { AgentRunOutcome } from "@/chat/runtime/agent-run-outcome";
|
|
|
15
15
|
import type { AgentTurnSurface } from "@/chat/state/turn-session";
|
|
16
16
|
import type { Actor } from "@/chat/actor";
|
|
17
17
|
import { loadTurnSessionRecord, persistRunningSessionRecord } from "@/chat/services/turn-session-record";
|
|
18
|
+
import { type AuthorizationPauseError } from "@/chat/services/auth-pause";
|
|
18
19
|
import { type AgentTurnUsage } from "@/chat/usage";
|
|
19
20
|
import { type AgentRunDurability } from "@/chat/agent/request";
|
|
20
21
|
type LoadedSessionRecordState = Awaited<ReturnType<typeof loadTurnSessionRecord>>;
|
|
@@ -36,15 +37,14 @@ interface ResumeStateArgs {
|
|
|
36
37
|
startedAtMs: number;
|
|
37
38
|
surface: AgentTurnSurface;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
40
|
+
type AuthPauseOutcome = Extract<AgentRunOutcome, {
|
|
41
|
+
status: "awaiting_auth";
|
|
42
|
+
}>;
|
|
42
43
|
/** Create the run's resume state: checkpoints, snapshots, and ending translation. */
|
|
43
44
|
export declare function createResumeState(args: ResumeStateArgs): {
|
|
44
45
|
readonly inputCommitted: boolean;
|
|
45
46
|
readonly beforeMessageCount: number;
|
|
46
47
|
readonly timedOut: boolean;
|
|
47
|
-
readonly cooperativeYieldError: CooperativeTurnYieldError | undefined;
|
|
48
48
|
setTurnStartMessageIndex(index: number | undefined): void;
|
|
49
49
|
setBeforeMessageCount(count: number): void;
|
|
50
50
|
/** Adopt an already committed epoch replacement as every resume baseline. */
|
|
@@ -55,16 +55,15 @@ export declare function createResumeState(args: ResumeStateArgs): {
|
|
|
55
55
|
commitInput(): Promise<void>;
|
|
56
56
|
persistSafeBoundary(messages: PiMessage[], trailingMessageProvenance?: ConversationMessageProvenance[]): Promise<boolean>;
|
|
57
57
|
requireDurableInputCheckpoint(messages: PiMessage[], trailingMessageProvenance?: ConversationMessageProvenance[]): Promise<boolean>;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
translateExpectedEnding(args2: {
|
|
58
|
+
/** Prepare a cooperative yield at the current durable boundary. */
|
|
59
|
+
prepareYieldIfDue(currentMessages: PiMessage[]): CooperativeTurnYieldError | undefined;
|
|
60
|
+
/** Persist an auth pause; only a durable pause may return `awaiting_auth`. */
|
|
61
|
+
parkForAuth(pause: AuthorizationPauseError, currentUsage?: AgentTurnUsage): Promise<AuthPauseOutcome>;
|
|
62
|
+
/** Persist a yield, retry, or timeout as a suspended run. */
|
|
63
|
+
translateSuspension(ending: {
|
|
65
64
|
currentUsage?: AgentTurnUsage;
|
|
66
65
|
error: unknown;
|
|
67
|
-
}): Promise<
|
|
66
|
+
}): Promise<AgentRunOutcome | undefined>;
|
|
68
67
|
};
|
|
69
68
|
export type ResumeState = ReturnType<typeof createResumeState>;
|
|
70
69
|
export {};
|
|
@@ -1,15 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Agent-facing sandbox adaptation.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* and
|
|
4
|
+
* The sandbox module owns provider lifecycle and recovery. This module adds
|
|
5
|
+
* agent-specific preparation, durable reference propagation, custom command
|
|
6
|
+
* routing, and generated-artifact materialization.
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
9
|
-
import type
|
|
8
|
+
import type { FileUpload } from "chat";
|
|
9
|
+
import { type Actor } from "@/chat/actor";
|
|
10
|
+
import type { ChannelConfigurationService } from "@/chat/configuration/types";
|
|
11
|
+
import type { CredentialContext } from "@/chat/credentials/context";
|
|
12
|
+
import type { LogContext } from "@/chat/logging";
|
|
13
|
+
import type { SandboxEgressTracePropagationConfig } from "@/chat/sandbox/egress/tracing";
|
|
14
|
+
import type { SandboxRef } from "@/chat/sandbox/ref";
|
|
15
|
+
import { type SandboxTools } from "@/chat/sandbox/sandbox";
|
|
10
16
|
import type { SandboxWorkspace } from "@/chat/sandbox/workspace";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
import type { Skill, SkillMetadata } from "@/chat/skills";
|
|
18
|
+
import type { GeneratedArtifactFileRef } from "@/chat/tools/sandbox/file-uploads";
|
|
19
|
+
export interface AgentSandboxOptions {
|
|
20
|
+
sandboxRef?: SandboxRef;
|
|
21
|
+
skills: SkillMetadata[];
|
|
22
|
+
traceContext: LogContext;
|
|
23
|
+
tracePropagation?: SandboxEgressTracePropagationConfig;
|
|
24
|
+
credentialEgress?: CredentialContext;
|
|
25
|
+
actor?: Actor;
|
|
26
|
+
channelConfiguration?: ChannelConfigurationService;
|
|
27
|
+
configurationValues: Record<string, unknown>;
|
|
28
|
+
getActiveSkill(): Skill | null;
|
|
29
|
+
prepareSandbox(workspace: SandboxWorkspace): void | Promise<void>;
|
|
30
|
+
onSandboxRefChanged(sandboxRef: SandboxRef): void;
|
|
31
|
+
persistSandboxRef?(sandboxRef: SandboxRef): void | Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export interface AgentSandbox {
|
|
34
|
+
readonly tools: SandboxTools;
|
|
35
|
+
readonly workspace: SandboxWorkspace;
|
|
36
|
+
sandboxRef(): SandboxRef | undefined;
|
|
37
|
+
writeGeneratedArtifacts(files: FileUpload[]): Promise<GeneratedArtifactFileRef[]>;
|
|
38
|
+
}
|
|
39
|
+
/** Create run-scoped sandbox capabilities adapted to the current agent context. */
|
|
40
|
+
export declare function createAgentSandbox(options: AgentSandboxOptions): AgentSandbox;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Run tool wiring.
|
|
3
3
|
*
|
|
4
4
|
* Builds everything the agent can act through for one run slice: the sandbox
|
|
5
|
-
*
|
|
5
|
+
* access, MCP and plugin auth orchestration, MCP
|
|
6
6
|
* provider restoration from durable history, and the Pi-facing tool surfaces
|
|
7
7
|
* (main-agent tools plus runtime control tools). Auth pauses raised while
|
|
8
8
|
* restoring providers are thrown here so the run parks before prompting.
|
|
@@ -16,11 +16,11 @@ import { McpToolManager } from "@/chat/mcp/tool-manager";
|
|
|
16
16
|
import type { AnyToolDefinition } from "@/chat/tools/definition";
|
|
17
17
|
import type { ToolRuntimeContext } from "@/chat/tools/types";
|
|
18
18
|
import { type ActiveMcpCatalogSummary } from "@/chat/tool-support/skill/mcp-tool-summary";
|
|
19
|
-
import {
|
|
19
|
+
import type { SandboxRef } from "@/chat/sandbox/ref";
|
|
20
20
|
import type { PiMessage } from "@/chat/pi/messages";
|
|
21
21
|
import type { LogContext } from "@/chat/logging";
|
|
22
22
|
import type { ConversationPrivacy } from "@/chat/conversation-privacy";
|
|
23
|
-
import {
|
|
23
|
+
import type { Actor } from "@/chat/actor";
|
|
24
24
|
import type { ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
25
25
|
import type { AuthorizationPauseError } from "@/chat/services/auth-pause";
|
|
26
26
|
import type { AgentTurnSurface } from "@/chat/state/turn-session";
|
|
@@ -41,10 +41,7 @@ interface ToolWiringArgs {
|
|
|
41
41
|
generatedFiles: FileUpload[];
|
|
42
42
|
invokedSkill: SkillMetadata | null;
|
|
43
43
|
observers: AgentRunObservers;
|
|
44
|
-
|
|
45
|
-
sandboxId?: string;
|
|
46
|
-
sandboxDependencyProfileHash?: string;
|
|
47
|
-
}) => void;
|
|
44
|
+
onSandboxRefChanged: (sandboxRef: SandboxRef) => void;
|
|
48
45
|
policy: AgentRunPolicy;
|
|
49
46
|
preAgentPromptMessages: () => PiMessage[];
|
|
50
47
|
priorPiMessages: PiMessage[] | undefined;
|
|
@@ -68,7 +65,7 @@ export interface ToolWiring {
|
|
|
68
65
|
getPendingAuthPause: () => AuthorizationPauseError | undefined;
|
|
69
66
|
mcpToolManager: McpToolManager;
|
|
70
67
|
pluginHooks: PluginHookRunner;
|
|
71
|
-
|
|
68
|
+
getSandboxRef: () => SandboxRef | undefined;
|
|
72
69
|
toolGuidance: Array<{
|
|
73
70
|
name: string;
|
|
74
71
|
promptGuidelines: AnyToolDefinition["promptGuidelines"];
|
package/dist/chat/config.d.ts
CHANGED
|
@@ -5,9 +5,12 @@ import { type ExecutionProfileConfig } from "@/chat/model-profile";
|
|
|
5
5
|
* Junior can abort, persist, and schedule continuation before host teardown.
|
|
6
6
|
*/
|
|
7
7
|
export declare const FUNCTION_TIMEOUT_BUFFER_SECONDS = 20;
|
|
8
|
+
/** Additional buffer that makes conversation work yield before the hard request deadline. */
|
|
9
|
+
export declare const CONVERSATION_WORK_SOFT_YIELD_BUFFER_SECONDS = 40;
|
|
8
10
|
export interface BotConfig {
|
|
9
11
|
embeddingModelId: string;
|
|
10
12
|
fastModelId: string;
|
|
13
|
+
imageGenerationModelId: string;
|
|
11
14
|
loadingMessages: string[];
|
|
12
15
|
profiles: Readonly<Record<string, ExecutionProfileConfig>>;
|
|
13
16
|
reasoningLevel?: TurnReasoningLevel;
|
|
@@ -16,11 +19,13 @@ export interface BotConfig {
|
|
|
16
19
|
maxSlicesPerTurn: number;
|
|
17
20
|
turnTimeoutMs: number;
|
|
18
21
|
userName: string;
|
|
22
|
+
webSearchModelId: string;
|
|
19
23
|
}
|
|
20
24
|
export type SqlDriver = "neon" | "postgres";
|
|
21
25
|
export interface ChatConfig {
|
|
22
26
|
bot: BotConfig;
|
|
23
27
|
functionMaxDurationSeconds: number;
|
|
28
|
+
conversationWorkSoftYieldAfterMs: number;
|
|
24
29
|
sql: {
|
|
25
30
|
databaseUrl: string;
|
|
26
31
|
driver: SqlDriver;
|
|
@@ -41,7 +46,9 @@ export interface ChatConfig {
|
|
|
41
46
|
};
|
|
42
47
|
}
|
|
43
48
|
/** Parse all chat configuration from environment variables. */
|
|
44
|
-
export declare function readChatConfig(env?: NodeJS.ProcessEnv): ChatConfig;
|
|
49
|
+
export declare function readChatConfig(env?: NodeJS.ProcessEnv, functionMaxDurationSeconds?: number): ChatConfig;
|
|
50
|
+
/** Apply the host execution budget injected by juniorNitro(). */
|
|
51
|
+
export declare function configureFunctionMaxDurationSeconds(functionMaxDurationSeconds: number): void;
|
|
45
52
|
/** Return the chat configuration (parsed once at startup). */
|
|
46
53
|
export declare function getChatConfig(): ChatConfig;
|
|
47
54
|
/** Bot configuration derived from environment at module load. */
|
|
@@ -25,6 +25,7 @@ export declare const historyReplacementSchema: z.ZodObject<{
|
|
|
25
25
|
type: z.ZodLiteral<"handoff">;
|
|
26
26
|
modelProfile: z.ZodString;
|
|
27
27
|
modelId: z.ZodString;
|
|
28
|
+
reasoningLevel: z.ZodOptional<z.ZodString>;
|
|
28
29
|
triggeringToolCallId: z.ZodOptional<z.ZodString>;
|
|
29
30
|
replacementHistory: z.ZodArray<z.ZodObject<{
|
|
30
31
|
message: z.ZodPipe<z.ZodObject<{
|
|
@@ -237,6 +238,7 @@ export declare const conversationEventDataSchema: z.ZodUnion<readonly [z.ZodUnio
|
|
|
237
238
|
type: z.ZodLiteral<"handoff">;
|
|
238
239
|
modelProfile: z.ZodString;
|
|
239
240
|
modelId: z.ZodString;
|
|
241
|
+
reasoningLevel: z.ZodOptional<z.ZodString>;
|
|
240
242
|
triggeringToolCallId: z.ZodOptional<z.ZodString>;
|
|
241
243
|
replacementHistory: z.ZodArray<z.ZodObject<{
|
|
242
244
|
message: z.ZodPipe<z.ZodObject<{
|
|
@@ -479,6 +481,7 @@ export declare const conversationEventSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
479
481
|
type: z.ZodLiteral<"handoff">;
|
|
480
482
|
modelProfile: z.ZodString;
|
|
481
483
|
modelId: z.ZodString;
|
|
484
|
+
reasoningLevel: z.ZodOptional<z.ZodString>;
|
|
482
485
|
triggeringToolCallId: z.ZodOptional<z.ZodString>;
|
|
483
486
|
replacementHistory: z.ZodArray<z.ZodObject<{
|
|
484
487
|
message: z.ZodPipe<z.ZodObject<{
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
import type { JuniorSqlDatabase } from "@/db/db";
|
|
2
|
-
import { juniorConversationEvents } from "@/db/schema";
|
|
3
2
|
import type { JuniorDestinationVisibility } from "@/db/schema/destinations";
|
|
4
3
|
/** Root conversation identity and its normalized destination visibility. */
|
|
5
4
|
export interface RootConversationVisibility {
|
|
6
5
|
rootConversationId: string;
|
|
7
6
|
visibility: JuniorDestinationVisibility | null;
|
|
8
7
|
}
|
|
9
|
-
type ConversationEventPrivacySnapshot = RootConversationVisibility & {
|
|
10
|
-
events: Array<typeof juniorConversationEvents.$inferSelect>;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Read selected event rows and their root privacy authority in one SQL snapshot.
|
|
14
|
-
*/
|
|
15
|
-
export declare function readConversationEventPrivacySnapshot(executor: JuniorSqlDatabase, args: {
|
|
16
|
-
conversationId: string;
|
|
17
|
-
eventTypes: readonly string[];
|
|
18
|
-
}): Promise<ConversationEventPrivacySnapshot | undefined>;
|
|
19
8
|
/**
|
|
20
9
|
* Resolve a conversation's privacy authority from its persisted root.
|
|
21
10
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
11
|
+
* Missing or structurally invalid root metadata fails closed. The root
|
|
12
|
+
* destination is locked so callers that keep the transaction open receive a
|
|
13
|
+
* stable visibility decision.
|
|
25
14
|
*/
|
|
26
15
|
export declare function resolveRootVisibility(executor: JuniorSqlDatabase, conversationId: string): Promise<RootConversationVisibility>;
|
|
27
|
-
export {};
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
/** Permissive schema for durable Pi SDK messages whose content shape may evolve. */
|
|
3
3
|
export declare const piMessageSchema: z.ZodPipe<z.ZodObject<{
|
|
4
4
|
role: z.ZodString;
|
|
5
|
-
}, z.core.$loose>, z.ZodTransform<import("@earendil-works/pi-ai").AssistantMessage | import("@earendil-works/pi-ai").UserMessage | import("@earendil-works/pi-ai").ToolResultMessage<any> | import("@earendil-works/pi-agent-core").
|
|
5
|
+
}, z.core.$loose>, z.ZodTransform<import("@earendil-works/pi-ai").AssistantMessage | import("@earendil-works/pi-ai").UserMessage | import("@earendil-works/pi-ai").ToolResultMessage<any> | import("@earendil-works/pi-agent-core").CustomMessage<unknown> | import("@earendil-works/pi-agent-core").BashExecutionMessage | import("@earendil-works/pi-agent-core").BranchSummaryMessage | import("@earendil-works/pi-agent-core").CompactionSummaryMessage, {
|
|
6
6
|
[x: string]: unknown;
|
|
7
7
|
role: string;
|
|
8
8
|
}>>;
|
|
@@ -12,7 +12,7 @@ export type PiMessage = z.output<typeof piMessageSchema>;
|
|
|
12
12
|
export declare const piContentMessageSchema: z.ZodPipe<z.ZodObject<{
|
|
13
13
|
content: z.ZodArray<z.ZodUnknown>;
|
|
14
14
|
role: z.ZodString;
|
|
15
|
-
}, z.core.$loose>, z.ZodTransform<import("@earendil-works/pi-ai").AssistantMessage | import("@earendil-works/pi-ai").UserMessage | import("@earendil-works/pi-ai").ToolResultMessage<any> | import("@earendil-works/pi-agent-core").
|
|
15
|
+
}, z.core.$loose>, z.ZodTransform<import("@earendil-works/pi-ai").AssistantMessage | import("@earendil-works/pi-ai").UserMessage | import("@earendil-works/pi-ai").ToolResultMessage<any> | import("@earendil-works/pi-agent-core").CustomMessage<unknown> | import("@earendil-works/pi-agent-core").BashExecutionMessage | import("@earendil-works/pi-agent-core").BranchSummaryMessage | import("@earendil-works/pi-agent-core").CompactionSummaryMessage, {
|
|
16
16
|
[x: string]: unknown;
|
|
17
17
|
content: unknown[];
|
|
18
18
|
role: string;
|
package/dist/chat/pi/sdk.d.ts
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* are re-exported here so tests can mock a single Junior-owned path instead
|
|
4
4
|
* of Pi's internal subpath layout, which changes across SDK versions.
|
|
5
5
|
*/
|
|
6
|
-
export { completeSimple, getEnvApiKey, getModels, registerApiProvider, type Message, type Model, type ThinkingLevel, } from "@earendil-works/pi-ai/compat";
|
|
6
|
+
export { completeSimple, getEnvApiKey, getModel, getModels, isRetryableAssistantError, registerApiProvider, type Message, type Model, type ThinkingLevel, } from "@earendil-works/pi-ai/compat";
|
|
7
7
|
export { stream as streamAnthropic, streamSimple as streamSimpleAnthropic, } from "@earendil-works/pi-ai/api/anthropic-messages";
|
|
@@ -4,7 +4,10 @@ import { type AgentTurnUsage } from "@/chat/usage";
|
|
|
4
4
|
* Aggregate real assistant calls by provider/model in SQL. Replayed history is
|
|
5
5
|
* not another call; its tokens appear in the next call's input usage.
|
|
6
6
|
*/
|
|
7
|
-
export declare function readConversationModelUsageFromSql(executor: JuniorSqlDatabase,
|
|
7
|
+
export declare function readConversationModelUsageFromSql(executor: JuniorSqlDatabase, options: {
|
|
8
|
+
conversationId: string;
|
|
9
|
+
includeDescendants?: boolean;
|
|
10
|
+
}): Promise<Array<{
|
|
8
11
|
modelId: string;
|
|
9
12
|
usage: AgentTurnUsage;
|
|
10
13
|
}>>;
|
|
@@ -2,7 +2,7 @@ import type { PluginRoute, PluginOperationalReport, PluginRouteApp, ResourceEven
|
|
|
2
2
|
import type { PluginPromptContributionContext } from "@/chat/plugins/prompt";
|
|
3
3
|
import type { AnyToolDefinition } from "@/chat/tools/definition";
|
|
4
4
|
import type { ToolRuntimeContext } from "@/chat/tools/types";
|
|
5
|
-
import type {
|
|
5
|
+
import type { SandboxWorkspace } from "@/chat/sandbox/workspace";
|
|
6
6
|
import type { Actor } from "@/chat/actor";
|
|
7
7
|
/** Signal that a plugin intentionally denied a tool execution. */
|
|
8
8
|
export declare class PluginHookDeniedError extends Error {
|
|
@@ -25,7 +25,7 @@ export interface PluginApiRouteRegistration {
|
|
|
25
25
|
}
|
|
26
26
|
export interface PluginHookRunner {
|
|
27
27
|
beforeToolExecute(input: ToolHookInput): Promise<ToolHookResult>;
|
|
28
|
-
prepareSandbox(
|
|
28
|
+
prepareSandbox(workspace: SandboxWorkspace): Promise<void>;
|
|
29
29
|
}
|
|
30
30
|
/** Validate plugin identity before it can affect process-wide hooks. */
|
|
31
31
|
export declare function validatePlugins(plugins: PluginRegistration[]): void;
|
|
@@ -11,14 +11,18 @@ export interface AgentContinueRunnerOptions {
|
|
|
11
11
|
sessionId: string;
|
|
12
12
|
}) => Promise<void>;
|
|
13
13
|
}
|
|
14
|
+
/** Per-worker controls for one continued run. */
|
|
15
|
+
export interface AgentContinueRunOptions {
|
|
16
|
+
shouldYield?: () => boolean;
|
|
17
|
+
}
|
|
14
18
|
/**
|
|
15
19
|
* Continue one paused Slack agent run from durable conversation state.
|
|
16
20
|
*
|
|
17
21
|
* Returns false when the session became stale before generation began.
|
|
18
22
|
*/
|
|
19
|
-
export declare function continueSlackAgentRun(payload: AgentContinueRequest, options: AgentContinueRunnerOptions): Promise<boolean>;
|
|
23
|
+
export declare function continueSlackAgentRun(payload: AgentContinueRequest, options: AgentContinueRunnerOptions, runOptions?: AgentContinueRunOptions): Promise<boolean>;
|
|
20
24
|
/** Resume the first valid paused Slack session for an idle conversation. */
|
|
21
|
-
export declare function resumeAwaitingSlackContinuation(conversationId: string, options: AgentContinueRunnerOptions): Promise<boolean>;
|
|
25
|
+
export declare function resumeAwaitingSlackContinuation(conversationId: string, options: AgentContinueRunnerOptions, runOptions?: AgentContinueRunOptions): Promise<boolean>;
|
|
22
26
|
/**
|
|
23
27
|
* Retry agent continuation when the normal Slack thread lock is briefly busy.
|
|
24
28
|
*
|
|
@@ -26,4 +30,4 @@ export declare function resumeAwaitingSlackContinuation(conversationId: string,
|
|
|
26
30
|
* lock that is rescheduled still returns true because runnable work remains
|
|
27
31
|
* durable.
|
|
28
32
|
*/
|
|
29
|
-
export declare function continueSlackAgentRunWithLockRetry(payload: AgentContinueRequest, options: AgentContinueRunnerOptions): Promise<boolean>;
|
|
33
|
+
export declare function continueSlackAgentRunWithLockRetry(payload: AgentContinueRequest, options: AgentContinueRunnerOptions, runOptions?: AgentContinueRunOptions): Promise<boolean>;
|
|
@@ -21,13 +21,12 @@ export interface AssistantLifecycleEvent {
|
|
|
21
21
|
userId?: string;
|
|
22
22
|
}
|
|
23
23
|
export interface SteeringCandidateMessage {
|
|
24
|
-
activeRequest: boolean;
|
|
25
24
|
inboundMessageId: string;
|
|
26
25
|
message: Message;
|
|
27
26
|
}
|
|
28
27
|
export interface ReplyHooks {
|
|
29
28
|
beforeFirstResponsePost?: () => Promise<void>;
|
|
30
|
-
drainSteeringMessages?: (accept: (messages: SteeringCandidateMessage[]) => Promise<readonly string[]
|
|
29
|
+
drainSteeringMessages?: (accept: (messages: SteeringCandidateMessage[]) => Promise<readonly string[]>) => Promise<void>;
|
|
31
30
|
messageContext?: MessageContext;
|
|
32
31
|
ack?: () => Promise<void>;
|
|
33
32
|
onToolInvocation?: (invocation: TurnToolInvocation) => void;
|
|
@@ -2,19 +2,15 @@ import type { Thread } from "chat";
|
|
|
2
2
|
import type { ChannelConfigurationService } from "@/chat/configuration/types";
|
|
3
3
|
import type { ThreadConversationState } from "@/chat/state/conversation";
|
|
4
4
|
import { type ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
5
|
+
import type { SandboxRef } from "@/chat/sandbox/ref";
|
|
5
6
|
export interface ThreadStatePatch {
|
|
6
7
|
artifacts?: ThreadArtifactsState;
|
|
7
8
|
conversation?: ThreadConversationState;
|
|
8
|
-
|
|
9
|
-
sandboxDependencyProfileHash?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface PersistedSandboxState {
|
|
12
|
-
sandboxDependencyProfileHash?: string;
|
|
13
|
-
sandboxId?: string;
|
|
9
|
+
sandboxRef?: SandboxRef | null;
|
|
14
10
|
}
|
|
15
11
|
export declare function mergeArtifactsState(artifacts: ThreadArtifactsState, patch: Partial<ThreadArtifactsState> | undefined): ThreadArtifactsState;
|
|
16
12
|
/** Extract persisted sandbox metadata from thread state payload. */
|
|
17
|
-
export declare function getPersistedSandboxState(state: Record<string, unknown>):
|
|
13
|
+
export declare function getPersistedSandboxState(state: Record<string, unknown>): SandboxRef | undefined;
|
|
18
14
|
/** Persist a thread-state patch through the Chat SDK thread interface. */
|
|
19
15
|
export declare function persistThreadState(thread: Thread, patch: ThreadStatePatch): Promise<void>;
|
|
20
16
|
/** Persist only the Redis-backed runtime scratch in a thread-state patch. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ThreadConversationState } from "@/chat/state/conversation";
|
|
2
|
+
import type { SandboxRef } from "@/chat/sandbox/ref";
|
|
2
3
|
import { type ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
3
4
|
import type { ChannelConfigurationService } from "@/chat/configuration/types";
|
|
4
5
|
import type { PrepareTurnStateInput, TurnContext } from "@/chat/runtime/turn-input";
|
|
@@ -8,8 +9,7 @@ export interface PreparedTurnState {
|
|
|
8
9
|
channelConfiguration?: ChannelConfigurationService;
|
|
9
10
|
conversation: ThreadConversationState;
|
|
10
11
|
conversationContext?: string;
|
|
11
|
-
|
|
12
|
-
sandboxDependencyProfileHash?: string;
|
|
12
|
+
sandboxRef?: SandboxRef;
|
|
13
13
|
userMessageAlreadyReplied?: boolean;
|
|
14
14
|
userMessageId?: string;
|
|
15
15
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { SandboxEgressAuthRequiredSignal, SandboxEgressPermissionDeniedSignal } from "@/chat/sandbox/egress/session";
|
|
2
|
+
export interface SandboxCommandOutcome {
|
|
3
|
+
ok: boolean;
|
|
4
|
+
command: string;
|
|
5
|
+
cwd: string;
|
|
6
|
+
exit_code: number;
|
|
7
|
+
signal: null;
|
|
8
|
+
timed_out: boolean;
|
|
9
|
+
aborted?: boolean;
|
|
10
|
+
stdout: string;
|
|
11
|
+
stderr: string;
|
|
12
|
+
stdout_truncated: boolean;
|
|
13
|
+
stderr_truncated: boolean;
|
|
14
|
+
auth_required?: SandboxEgressAuthRequiredSignal;
|
|
15
|
+
permission_denied?: SandboxEgressPermissionDeniedSignal;
|
|
16
|
+
}
|
|
17
|
+
/** Format one shell command outcome as Junior's structured tool result. */
|
|
18
|
+
export declare function formatSandboxCommandResult(params: SandboxCommandOutcome): import("@/chat/tool-support/structured-result").JuniorTextToolResultEnvelope<{
|
|
19
|
+
permission_denied?: {
|
|
20
|
+
grant: {
|
|
21
|
+
access: "read" | "write";
|
|
22
|
+
name: string;
|
|
23
|
+
leaseScope?: string | undefined;
|
|
24
|
+
reason?: string | undefined;
|
|
25
|
+
requirements?: string[] | undefined;
|
|
26
|
+
};
|
|
27
|
+
message: string;
|
|
28
|
+
provider: string;
|
|
29
|
+
source: "upstream";
|
|
30
|
+
status: number;
|
|
31
|
+
upstreamHost: string;
|
|
32
|
+
upstreamPath: string;
|
|
33
|
+
createdAtMs: number;
|
|
34
|
+
account?: {
|
|
35
|
+
id: string;
|
|
36
|
+
label?: string | undefined;
|
|
37
|
+
url?: string | undefined;
|
|
38
|
+
} | undefined;
|
|
39
|
+
acceptedPermissions?: string | undefined;
|
|
40
|
+
sso?: string | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
auth_required?: {
|
|
43
|
+
grant: {
|
|
44
|
+
access: "read" | "write";
|
|
45
|
+
name: string;
|
|
46
|
+
leaseScope?: string | undefined;
|
|
47
|
+
reason?: string | undefined;
|
|
48
|
+
requirements?: string[] | undefined;
|
|
49
|
+
};
|
|
50
|
+
kind: "unavailable" | "auth_required";
|
|
51
|
+
provider: string;
|
|
52
|
+
createdAtMs: number;
|
|
53
|
+
authorization?: {
|
|
54
|
+
provider: string;
|
|
55
|
+
type: "oauth";
|
|
56
|
+
scope?: string | undefined;
|
|
57
|
+
} | undefined;
|
|
58
|
+
message?: string | undefined;
|
|
59
|
+
} | undefined;
|
|
60
|
+
command: string;
|
|
61
|
+
cwd: string;
|
|
62
|
+
exit_code: number;
|
|
63
|
+
signal: null;
|
|
64
|
+
timed_out: boolean;
|
|
65
|
+
aborted: boolean;
|
|
66
|
+
stdout: string;
|
|
67
|
+
stderr: string;
|
|
68
|
+
stdout_truncated: boolean;
|
|
69
|
+
stderr_truncated: boolean;
|
|
70
|
+
error?: {
|
|
71
|
+
kind: string;
|
|
72
|
+
message: string;
|
|
73
|
+
retryable: boolean;
|
|
74
|
+
} | undefined;
|
|
75
|
+
ok: boolean;
|
|
76
|
+
status: "error" | "success";
|
|
77
|
+
target: string;
|
|
78
|
+
data: {
|
|
79
|
+
command: string;
|
|
80
|
+
cwd: string;
|
|
81
|
+
exit_code: number;
|
|
82
|
+
signal: null;
|
|
83
|
+
timed_out: boolean;
|
|
84
|
+
aborted: boolean;
|
|
85
|
+
stdout: string;
|
|
86
|
+
stderr: string;
|
|
87
|
+
stdout_truncated: boolean;
|
|
88
|
+
stderr_truncated: boolean;
|
|
89
|
+
};
|
|
90
|
+
truncated: boolean;
|
|
91
|
+
}>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** Detect sandbox filesystem operations that can safely ignore existing directories. */
|
|
2
2
|
export declare function isAlreadyExistsError(error: unknown): boolean;
|
|
3
|
-
/** Detect when
|
|
3
|
+
/** Detect when the current sandbox session is unavailable and must be reacquired. */
|
|
4
4
|
export declare function isSandboxUnavailableError(error: unknown): boolean;
|
|
5
|
+
/** Detect a durable sandbox reference that can no longer be restored. */
|
|
6
|
+
export declare function isSandboxMissingError(error: unknown): boolean;
|
|
5
7
|
/** Detect transient snapshot boot races so sandbox creation can retry. */
|
|
6
8
|
export declare function isSnapshottingError(error: unknown): boolean;
|
|
7
9
|
/** Detect interrupted command streams where no reliable exit status is available. */
|