@sentry/junior 0.132.0 → 0.134.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-ONXOJDR6.js → agent-hooks-HGXNYOOD.js} +9 -9
- package/dist/api/schema/task.d.ts +60 -0
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +3 -1
- package/dist/api.js +90 -20
- package/dist/app.js +110 -39
- package/dist/{catalog-runtime-BATAY4R7.js → catalog-runtime-P6QHU6XE.js} +5 -5
- package/dist/chat/agent/prompt.d.ts +7 -5
- package/dist/chat/agent/repository-context.d.ts +20 -0
- package/dist/chat/agent/sandbox.d.ts +8 -0
- package/dist/chat/agent/tools.d.ts +3 -0
- package/dist/chat/config.d.ts +2 -0
- package/dist/chat/conversations/projection.d.ts +3 -1
- package/dist/chat/conversations/sql/bindings.d.ts +13 -0
- package/dist/chat/conversations/sql/store.d.ts +3 -0
- package/dist/chat/conversations/store.d.ts +15 -0
- package/dist/chat/plugins/agent-hooks.d.ts +2 -2
- package/dist/chat/repository-instructions.d.ts +44 -0
- package/dist/chat/runtime/reply-executor.d.ts +1 -0
- package/dist/chat/runtime/slack-runtime.d.ts +2 -0
- package/dist/chat/sandbox/noninteractive-command.d.ts +2 -0
- package/dist/chat/sandbox/sandbox.d.ts +3 -0
- package/dist/chat/sandbox/session.d.ts +1 -0
- package/dist/chat/services/context-compaction.d.ts +1 -0
- package/dist/chat/slack/dispatch-turn.d.ts +1 -0
- package/dist/chat/slack/reply.d.ts +1 -1
- package/dist/chat/slack/tools/user-lookup.d.ts +2 -6
- package/dist/chat/tasks/execution-stats.d.ts +29 -0
- package/dist/chat/tasks/registered.d.ts +3 -0
- package/dist/chat/tools/index.d.ts +2 -0
- package/dist/chat/tools/sandbox/bash.d.ts +1 -0
- package/dist/chat/tools/system-time.d.ts +11 -1
- package/dist/{chunk-O2UXPUVQ.js → chunk-52DIKFJV.js} +14 -6
- package/dist/{chunk-GOEZU33G.js → chunk-6T3AYZT7.js} +1 -1
- package/dist/{chunk-GPXVDJML.js → chunk-7GKQ7UIO.js} +449 -39
- package/dist/{chunk-QVEXYYFM.js → chunk-7UTBPDXK.js} +24 -1
- package/dist/{chunk-U76PS7AT.js → chunk-AS3I7OIL.js} +2 -2
- package/dist/{chunk-HX236W2U.js → chunk-CDQ4YIZM.js} +9 -0
- package/dist/{chunk-ODIP5CEM.js → chunk-FDNAUM7X.js} +32 -32
- package/dist/{chunk-GTKNPQNN.js → chunk-FL466XX5.js} +36 -24
- package/dist/{chunk-2425Q4OR.js → chunk-GSP5SMZJ.js} +1 -1
- package/dist/{chunk-XN656LB4.js → chunk-KWGJG4HO.js} +6 -12
- package/dist/{chunk-ISNRPCPG.js → chunk-LKK4XMUV.js} +1 -1
- package/dist/{chunk-G3WYA2RS.js → chunk-MFERLE3G.js} +1 -1
- package/dist/{chunk-ZMV2YBT6.js → chunk-NF2TNZPD.js} +788 -674
- package/dist/chunk-NOA34AJY.js +122 -0
- package/dist/{chunk-JYQAE2ZU.js → chunk-NYWSCJVW.js} +1 -1
- package/dist/{chunk-KB2M27DL.js → chunk-QLEKAO7O.js} +130 -40
- package/dist/{chunk-BKE47OOW.js → chunk-S6DMTEOM.js} +2 -2
- package/dist/{chunk-ALDPUN3Z.js → chunk-TR6UEEYD.js} +8 -6
- package/dist/{chunk-WEJIS7OC.js → chunk-U3ZI7CCW.js} +1 -1
- package/dist/{chunk-B7IY6SVJ.js → chunk-VEGF62FV.js} +1 -1
- package/dist/{chunk-SKWIIUS7.js → chunk-VGXJMECA.js} +7 -7
- package/dist/{chunk-V44FFBO3.js → chunk-VP6NCPRS.js} +1 -1
- package/dist/{chunk-WYQP7QSB.js → chunk-VPYKNCTN.js} +101 -61
- package/dist/{chunk-NNHUGGO4.js → chunk-XG5PHKPM.js} +19 -3
- package/dist/{chunk-AW5Z3T7V.js → chunk-YNLQQ622.js} +9 -8
- package/dist/cli/chat.js +25 -25
- package/dist/cli/check.js +6 -6
- package/dist/cli/init.js +1 -1
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +9 -8
- package/dist/db/executor.d.ts +2 -1
- package/dist/db/neon.d.ts +1 -0
- package/dist/db/postgres.d.ts +1 -0
- package/dist/db/schema/conversation-bindings.d.ts +110 -0
- package/dist/db/schema/task-executions.d.ts +110 -0
- package/dist/db/schema.d.ts +221 -1
- package/dist/{db-QFFZACXF.js → db-GFK4NHWJ.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-5WXLD533.js → oauth-callback-server-HUJLAQ5N.js} +19 -18
- package/dist/{runner-Y3LTUNAA.js → runner-T77AFAH4.js} +13 -12
- package/dist/{skills-7M5C24GM.js → skills-3KUFJOOR.js} +6 -6
- package/dist/{validation-MRILMYDI.js → validation-FMWDHKYU.js} +6 -6
- package/dist/version.js +1 -1
- package/migrations/0018_curvy_excalibur.sql +12 -0
- package/migrations/0019_lowly_valkyrie.sql +14 -0
- package/migrations/meta/0018_snapshot.json +1756 -0
- package/migrations/meta/0019_snapshot.json +1904 -0
- package/migrations/meta/_journal.json +15 -1
- package/package.json +5 -5
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { PiMessage } from "@/chat/pi/messages";
|
|
2
|
+
import type { SandboxFileSystem } from "@/chat/sandbox/workspace";
|
|
3
|
+
export declare const AGENTS_REPLACEMENT_NOTICE = "These AGENTS.md instructions replace all previously provided AGENTS.md instructions.";
|
|
4
|
+
export declare const AGENTS_REMOVAL_NOTICE = "The previously provided AGENTS.md instructions no longer apply.";
|
|
5
|
+
/** Effective AGENTS.md instructions plus host-only discovery provenance. */
|
|
6
|
+
export interface RepositoryInstructions {
|
|
7
|
+
directory: string;
|
|
8
|
+
fingerprint: string;
|
|
9
|
+
sources: Array<{
|
|
10
|
+
content: string;
|
|
11
|
+
path: string;
|
|
12
|
+
}>;
|
|
13
|
+
text: string;
|
|
14
|
+
}
|
|
15
|
+
/** Latest model-visible AGENTS.md state parsed from trusted runtime context. */
|
|
16
|
+
export type VisibleAgentsInstructions = {
|
|
17
|
+
active: false;
|
|
18
|
+
} | {
|
|
19
|
+
active: true;
|
|
20
|
+
directory?: string;
|
|
21
|
+
text: string;
|
|
22
|
+
};
|
|
23
|
+
/** Return the only direct-child Git worktree, without guessing when ambiguous. */
|
|
24
|
+
export declare function findSingleRepositoryDirectory(fs: SandboxFileSystem): Promise<string | undefined>;
|
|
25
|
+
/** Resolve the effective root-to-cwd AGENTS.md bundle for one selected directory. */
|
|
26
|
+
export declare function resolveRepositoryInstructions(args: {
|
|
27
|
+
cwd: string;
|
|
28
|
+
fs: SandboxFileSystem;
|
|
29
|
+
}): Promise<RepositoryInstructions | undefined>;
|
|
30
|
+
/** Render repository instructions with Codex's exact model-visible wrapper. */
|
|
31
|
+
export declare function renderAgentsInstructions(args: {
|
|
32
|
+
directory?: string;
|
|
33
|
+
text: string;
|
|
34
|
+
}): string;
|
|
35
|
+
/** Build one user-role repository-instructions context message. */
|
|
36
|
+
export declare function buildAgentsInstructionsMessage(args: {
|
|
37
|
+
directory?: string;
|
|
38
|
+
text: string;
|
|
39
|
+
timestamp?: number;
|
|
40
|
+
}): PiMessage;
|
|
41
|
+
/** Read the latest effective AGENTS.md state from model-visible history. */
|
|
42
|
+
export declare function findVisibleAgentsInstructions(messages: PiMessage[]): VisibleAgentsInstructions | undefined;
|
|
43
|
+
/** Whether one message is a generated AGENTS.md context update. */
|
|
44
|
+
export declare function isAgentsInstructionsMessage(message: PiMessage): boolean;
|
|
@@ -55,6 +55,7 @@ interface ReplyExecutorDeps {
|
|
|
55
55
|
/** Build the shared reply handler that prepares, advances, and commits a turn. */
|
|
56
56
|
export declare function createReplyToThread(deps: ReplyExecutorDeps): (thread: Thread, message: Message, options: {
|
|
57
57
|
beforeFirstResponsePost?: () => Promise<void>;
|
|
58
|
+
conversationId?: string;
|
|
58
59
|
destination: Destination;
|
|
59
60
|
explicitMention?: boolean;
|
|
60
61
|
ack?: () => Promise<void>;
|
|
@@ -38,6 +38,7 @@ interface SteeringDrainContext {
|
|
|
38
38
|
conversationContext?: string;
|
|
39
39
|
}
|
|
40
40
|
export interface SlackTurnOptions extends ReplyHooks {
|
|
41
|
+
conversationId?: string;
|
|
41
42
|
destination: Destination;
|
|
42
43
|
}
|
|
43
44
|
export interface SlackTurnRuntimeDependencies<TPreparedState> {
|
|
@@ -93,6 +94,7 @@ export interface SlackTurnRuntimeDependencies<TPreparedState> {
|
|
|
93
94
|
prepareTurnState: (args: PrepareTurnStateInput) => Promise<TPreparedState>;
|
|
94
95
|
replyToThread: (thread: Thread, message: Message, options: {
|
|
95
96
|
beforeFirstResponsePost?: () => Promise<void>;
|
|
97
|
+
conversationId?: string;
|
|
96
98
|
destination: Destination;
|
|
97
99
|
explicitMention?: boolean;
|
|
98
100
|
ack?: () => Promise<void>;
|
|
@@ -11,6 +11,8 @@ interface NonInteractiveCommandInput extends NonInteractiveShellOptions {
|
|
|
11
11
|
signal?: AbortSignal;
|
|
12
12
|
sudo?: boolean;
|
|
13
13
|
}
|
|
14
|
+
/** Render one argv command as a safely quoted shell script. */
|
|
15
|
+
export declare function buildCommandScript(input: Pick<NonInteractiveCommandInput, "args" | "cmd">): string;
|
|
14
16
|
/** Build one shell entrypoint that never waits on terminal input. */
|
|
15
17
|
export declare function buildNonInteractiveShellScript(script: string, options?: NonInteractiveShellOptions): string;
|
|
16
18
|
/** Run a subprocess through one enforced non-interactive entrypoint. */
|
|
@@ -2,6 +2,7 @@ import { type LogContext, type SetSpanAttributes } from "@/chat/logging";
|
|
|
2
2
|
import type { SandboxEgressSignalTransport } from "@/chat/sandbox/egress/signals";
|
|
3
3
|
import type { SandboxEgressTracePropagationConfig } from "@/chat/sandbox/egress/tracing";
|
|
4
4
|
import type { CredentialContext } from "@/chat/credentials/context";
|
|
5
|
+
import { type RepositoryInstructions } from "@/chat/repository-instructions";
|
|
5
6
|
import type { SandboxRef } from "@/chat/sandbox/ref";
|
|
6
7
|
import { type SandboxWorkspace } from "@/chat/sandbox/workspace";
|
|
7
8
|
import type { SkillMetadata } from "@/chat/skills";
|
|
@@ -17,6 +18,8 @@ export interface SandboxTools {
|
|
|
17
18
|
execute(params: SandboxToolCall): Promise<unknown>;
|
|
18
19
|
}
|
|
19
20
|
export interface SandboxAccess {
|
|
21
|
+
/** Resolve the AGENTS.md bundle for the selected repository directory. */
|
|
22
|
+
captureRepositoryInstructions(): Promise<RepositoryInstructions | undefined>;
|
|
20
23
|
readonly tools: SandboxTools;
|
|
21
24
|
readonly workspace: SandboxWorkspace;
|
|
22
25
|
sandboxRef(): SandboxRef | undefined;
|
|
@@ -55,6 +55,7 @@ interface ActiveContextCompactionArgs {
|
|
|
55
55
|
provenance: ConversationMessageProvenance;
|
|
56
56
|
}>;
|
|
57
57
|
piMessages: PiMessage[];
|
|
58
|
+
runtimeContextMessages?: PiMessage[];
|
|
58
59
|
signal?: AbortSignal;
|
|
59
60
|
}
|
|
60
61
|
/** Raised when Junior cannot compact history below the active model's hard ceiling. */
|
|
@@ -5,6 +5,7 @@ import type { DispatchRecord } from "@/chat/agent-dispatch/types";
|
|
|
5
5
|
interface DispatchReplyToThread {
|
|
6
6
|
(thread: ThreadImpl, message: Message, options: {
|
|
7
7
|
ack?: () => Promise<void>;
|
|
8
|
+
conversationId?: string;
|
|
8
9
|
destination: DispatchRecord["destination"];
|
|
9
10
|
execution: DispatchTurnContext;
|
|
10
11
|
onTurnDeliveryAccepted?: (messageId?: string) => void;
|
|
@@ -3,12 +3,8 @@ export declare function createSlackUserLookupTool(): Omit<import("../../tools/de
|
|
|
3
3
|
inputSchema: import("../../tools/definition").JsonSchemaObject;
|
|
4
4
|
outputSchema: import("../../tools/definition").JsonSchemaObject;
|
|
5
5
|
prepareArguments(args: unknown): {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
query?: string | undefined;
|
|
9
|
-
limit?: number | undefined;
|
|
10
|
-
max_pages?: number | undefined;
|
|
11
|
-
include_bots?: boolean | undefined;
|
|
6
|
+
mode: "query" | "email" | "user_id";
|
|
7
|
+
value: string;
|
|
12
8
|
};
|
|
13
9
|
execute?: ((input: unknown, options: import("../../tools/definition").ToolExecuteOptions) => {
|
|
14
10
|
[x: string]: unknown;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const TASK_EXECUTION_TYPES: readonly ["registered", "scheduled", "event"];
|
|
2
|
+
export type TaskExecutionType = (typeof TASK_EXECUTION_TYPES)[number];
|
|
3
|
+
export type TaskExecutionDay = {
|
|
4
|
+
date: string;
|
|
5
|
+
event: number;
|
|
6
|
+
registered: number;
|
|
7
|
+
scheduled: number;
|
|
8
|
+
};
|
|
9
|
+
export type TaskExecutionSummary = {
|
|
10
|
+
lastConversationId?: string;
|
|
11
|
+
lastExecutedAtMs?: number;
|
|
12
|
+
runsLast7Days: number;
|
|
13
|
+
totalRuns: number;
|
|
14
|
+
};
|
|
15
|
+
/** Record one successful task execution and its durable conversation. */
|
|
16
|
+
export declare function recordTaskExecution(type: TaskExecutionType, taskId: string, options: {
|
|
17
|
+
conversationId: string;
|
|
18
|
+
executionId: string;
|
|
19
|
+
namespace?: string;
|
|
20
|
+
nowMs?: number;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
/** Load usage analytics for all tasks of one type and namespace. */
|
|
23
|
+
export declare function readTaskExecutionSummaries(type: TaskExecutionType, namespace: string, options?: {
|
|
24
|
+
nowMs?: number;
|
|
25
|
+
}): Promise<Map<string, TaskExecutionSummary>>;
|
|
26
|
+
/** Load a fixed trailing window of successful executions stacked by task type. */
|
|
27
|
+
export declare function readTaskExecutionDays(dayCount?: number, options?: {
|
|
28
|
+
nowMs?: number;
|
|
29
|
+
}): Promise<TaskExecutionDay[]>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { SkillMetadata } from "@/chat/skills";
|
|
2
2
|
import type { ToolRegistry } from "@/chat/tools/definition";
|
|
3
3
|
import type { ToolHooks, ToolRuntimeContext } from "@/chat/tools/types";
|
|
4
|
+
import type { PluginSandbox } from "@sentry/junior-plugin-api";
|
|
4
5
|
export type { ToolHooks, ToolRuntimeContext };
|
|
5
6
|
export interface CreateToolsOptions {
|
|
6
7
|
includeLoadSkill?: boolean;
|
|
8
|
+
pluginSandbox?: PluginSandbox;
|
|
7
9
|
}
|
|
8
10
|
/** Build the model-facing tool registry from runtime-owned context and capabilities. */
|
|
9
11
|
export declare function createTools(availableSkills: SkillMetadata[], hooks: ToolHooks | undefined, context: ToolRuntimeContext, options?: CreateToolsOptions): ToolRegistry;
|
|
@@ -4,6 +4,7 @@ export declare function createBashTool(): Omit<import("../definition").AnyToolDe
|
|
|
4
4
|
outputSchema: import("../definition").JsonSchemaObject;
|
|
5
5
|
prepareArguments(args: unknown): {
|
|
6
6
|
command: string;
|
|
7
|
+
cwd?: string | undefined;
|
|
7
8
|
timeoutMs?: number | undefined;
|
|
8
9
|
};
|
|
9
10
|
execute?: ((input: unknown, options: import("../definition").ToolExecuteOptions) => Promise<never>) | undefined;
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Current-time lookup for turn answers.
|
|
3
|
+
*
|
|
4
|
+
* Accept an optional IANA timezone so remembered local-time preferences can be
|
|
5
|
+
* answered without shelling out to bash for conversion.
|
|
6
|
+
*/
|
|
1
7
|
export declare function createSystemTimeTool(): Omit<import("./definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
2
8
|
inputSchema: import("./definition").JsonSchemaObject;
|
|
3
9
|
outputSchema: import("./definition").JsonSchemaObject;
|
|
4
|
-
prepareArguments(args: unknown):
|
|
10
|
+
prepareArguments(args: unknown): {
|
|
11
|
+
timezone?: string | undefined;
|
|
12
|
+
};
|
|
5
13
|
execute?: ((input: unknown, options: import("./definition").ToolExecuteOptions) => {
|
|
6
14
|
[x: string]: unknown;
|
|
7
15
|
unix_ms: number;
|
|
8
16
|
iso_utc: string;
|
|
9
17
|
iso_local: string;
|
|
18
|
+
timezone: string | null;
|
|
10
19
|
timezone_offset_minutes: number;
|
|
11
20
|
target?: string | undefined;
|
|
12
21
|
truncated?: boolean | undefined;
|
|
@@ -19,6 +28,7 @@ export declare function createSystemTimeTool(): Omit<import("./definition").AnyT
|
|
|
19
28
|
unix_ms: number;
|
|
20
29
|
iso_utc: string;
|
|
21
30
|
iso_local: string;
|
|
31
|
+
timezone: string | null;
|
|
22
32
|
timezone_offset_minutes: number;
|
|
23
33
|
target?: string | undefined;
|
|
24
34
|
truncated?: boolean | undefined;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
recordTaskExecution
|
|
3
|
+
} from "./chunk-NOA34AJY.js";
|
|
1
4
|
import {
|
|
2
5
|
pluginTaskId,
|
|
3
6
|
pluginTaskParamsSchema,
|
|
@@ -22,7 +25,7 @@ import {
|
|
|
22
25
|
persistThreadStateById,
|
|
23
26
|
stripRuntimeTurnContext,
|
|
24
27
|
updateConversationStats
|
|
25
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-7GKQ7UIO.js";
|
|
26
29
|
import {
|
|
27
30
|
createPluginConversationEvents,
|
|
28
31
|
createPluginEmbedder,
|
|
@@ -30,26 +33,26 @@ import {
|
|
|
30
33
|
createPluginModel,
|
|
31
34
|
createPluginState,
|
|
32
35
|
getPlugins
|
|
33
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-TR6UEEYD.js";
|
|
34
37
|
import {
|
|
35
38
|
getDb,
|
|
36
39
|
sameActorIdentity
|
|
37
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-VPYKNCTN.js";
|
|
38
41
|
import {
|
|
39
42
|
getStateAdapter
|
|
40
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-FDNAUM7X.js";
|
|
41
44
|
import {
|
|
42
45
|
ProviderError,
|
|
43
46
|
findProviderError,
|
|
44
47
|
getProviderErrorAttributes,
|
|
45
48
|
getProviderErrorUserMessage
|
|
46
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-XG5PHKPM.js";
|
|
47
50
|
import {
|
|
48
51
|
parseSlackMessageTs
|
|
49
52
|
} from "./chunk-F3B2YJ76.js";
|
|
50
53
|
import {
|
|
51
54
|
buildTurnFailureResponse
|
|
52
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-6T3AYZT7.js";
|
|
53
56
|
|
|
54
57
|
// src/chat/runtime/delivered-turn-state.ts
|
|
55
58
|
function buildDeliveredTurnStatePatch(args) {
|
|
@@ -378,6 +381,11 @@ async function processPluginTask(message, options = {}) {
|
|
|
378
381
|
await resolved.task.run(
|
|
379
382
|
taskPluginContext(resolved.plugin, message, options)
|
|
380
383
|
);
|
|
384
|
+
await recordTaskExecution("registered", message.name, {
|
|
385
|
+
conversationId: message.params.conversationId,
|
|
386
|
+
executionId: pluginTaskId(message),
|
|
387
|
+
namespace: message.plugin
|
|
388
|
+
});
|
|
381
389
|
});
|
|
382
390
|
}
|
|
383
391
|
|