@sentry/junior 0.164.0 → 0.166.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-WTBPNRTC.js → agent-hooks-ZIPK2HUF.js} +9 -9
- package/dist/api/schema/workspace.d.ts +10 -4
- package/dist/api/schema.js +1 -1
- package/dist/api.js +52 -27
- package/dist/app.js +59 -60
- package/dist/{catalog-runtime-CZ2SQINY.js → catalog-runtime-GEZAHBUP.js} +5 -5
- package/dist/chat/pi/transcript.d.ts +10 -10
- package/dist/chat/repository-instructions.d.ts +12 -1
- package/dist/chat/sandbox/sandbox.d.ts +1 -1
- package/dist/chat/sandbox/snapshot/resolve.d.ts +16 -0
- package/dist/chat/sandbox/snapshot/runtime.d.ts +2 -0
- package/dist/chat/services/conversation-memory.d.ts +7 -0
- package/dist/chat/workspaces/store.d.ts +10 -3
- package/dist/chat/workspaces/types.d.ts +8 -1
- package/dist/chat/workspaces/validation.d.ts +0 -1
- package/dist/{chunk-HHW6ZVIZ.js → chunk-22RO7IDD.js} +109 -21
- package/dist/{chunk-FKDY7NTC.js → chunk-2KV4BAAN.js} +12 -12
- package/dist/{chunk-Y2B6AXZQ.js → chunk-2ZKFLHVP.js} +6 -6
- package/dist/{chunk-ZUTAGCPH.js → chunk-3EZ5V7XQ.js} +9 -9
- package/dist/{chunk-3L23VTY7.js → chunk-43KLUCAM.js} +17 -17
- package/dist/{chunk-PU45BSBS.js → chunk-4CMORAHL.js} +9 -5
- package/dist/chunk-4DARCEZH.js +274 -0
- package/dist/{chunk-6ENAACWN.js → chunk-4MDEQNSW.js} +9 -5
- package/dist/{chunk-ZSNABC2E.js → chunk-65SNO3WK.js} +9 -7
- package/dist/{chunk-WJUKESU2.js → chunk-ABNRESX6.js} +1 -1
- package/dist/{chunk-FX4PX3SA.js → chunk-AEKBVJMV.js} +2 -2
- package/dist/{chunk-26JYGL2L.js → chunk-BKP3PVKR.js} +1 -1
- package/dist/{chunk-XAIRI54J.js → chunk-C3USHSIJ.js} +1 -1
- package/dist/{chunk-RYYEHWIL.js → chunk-CDBTQQQ4.js} +1 -1
- package/dist/{chunk-2K25MRZK.js → chunk-DTQAMME2.js} +5 -5
- package/dist/{chunk-BXBZDV3C.js → chunk-EKBVHDZO.js} +1 -1
- package/dist/{chunk-6BXV63YX.js → chunk-FEYQVP64.js} +5 -5
- package/dist/{chunk-H36GJVJV.js → chunk-FFE3BMAT.js} +7 -7
- package/dist/{chunk-LPLVNMVN.js → chunk-JDTCQDRU.js} +3 -3
- package/dist/{chunk-VHSEMJTS.js → chunk-JUFZR2LD.js} +1 -1
- package/dist/{chunk-RBV4JHCP.js → chunk-KQ5YZGDV.js} +1 -1
- package/dist/{chunk-4GTOFUQF.js → chunk-LGSGPWYH.js} +1 -1
- package/dist/{chunk-NLTQRYNP.js → chunk-MDW5YPXW.js} +2 -2
- package/dist/{chunk-5FWQ73UZ.js → chunk-OCOGPNHA.js} +1 -1
- package/dist/{chunk-JW23XD4I.js → chunk-OYN45QUQ.js} +6 -6
- package/dist/{chunk-VV2DN24T.js → chunk-P6UQMGM2.js} +1 -1
- package/dist/{chunk-RJHZNPDH.js → chunk-Q2IPCX7J.js} +45 -282
- package/dist/{chunk-7WKWMMYQ.js → chunk-SLWGX3G5.js} +93 -85
- package/dist/{chunk-CGCNFEAU.js → chunk-U2UCDSDF.js} +4 -4
- package/dist/{chunk-RULIISEI.js → chunk-VNPG55CU.js} +1 -1
- package/dist/{chunk-YHCTPDXS.js → chunk-WX42YNDQ.js} +67 -24
- package/dist/{chunk-5GLGQHO3.js → chunk-YTIKGCPC.js} +2 -1
- package/dist/{chunk-NAGI2XH3.js → chunk-ZKJO4K6M.js} +4 -4
- package/dist/cli/chat.js +30 -29
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +12 -10
- package/dist/cli/upgrade.js +7 -7
- package/dist/db/schema/workspaces.d.ts +68 -17
- package/dist/db/schema.d.ts +68 -17
- package/dist/{db-32KRFS6L.js → db-TGZBS2CP.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-CGZP2Z6U.js → oauth-callback-server-Z54WUF5H.js} +22 -22
- package/dist/{runner-S5N4Q2XL.js → runner-PVFHKKK6.js} +12 -12
- package/dist/{skills-KYPSHSQR.js → skills-BYRH3QWD.js} +6 -6
- package/dist/spawn-RIPWK7EP.js +37 -0
- package/dist/{validation-SZBE7JNF.js → validation-VZIE4RHA.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-GCZKHEZX.js → work-JTHAOPDQ.js} +17 -17
- package/dist/worker-APEVP56Y.js +24 -0
- package/migrations/0030_drop_workspace_repo_primary.sql +2 -0
- package/migrations/0031_wild_phantom_reporter.sql +4 -0
- package/migrations/meta/0030_snapshot.json +2799 -0
- package/migrations/meta/0031_snapshot.json +2823 -0
- package/migrations/meta/_journal.json +15 -1
- package/package.json +6 -5
- package/dist/spawn-EGOB3CLV.js +0 -37
- package/dist/worker-6MY5Q4A2.js +0 -24
|
@@ -4,7 +4,8 @@ export declare const AGENTS_REPLACEMENT_NOTICE = "These AGENTS.md instructions r
|
|
|
4
4
|
export declare const AGENTS_REMOVAL_NOTICE = "The previously provided AGENTS.md instructions no longer apply.";
|
|
5
5
|
/** Effective AGENTS.md instructions plus host-only discovery provenance. */
|
|
6
6
|
export interface RepositoryInstructions {
|
|
7
|
-
directory
|
|
7
|
+
/** Selected directory when instructions come from one repository tree. */
|
|
8
|
+
directory?: string;
|
|
8
9
|
fingerprint: string;
|
|
9
10
|
sources: Array<{
|
|
10
11
|
content: string;
|
|
@@ -20,12 +21,22 @@ export type VisibleAgentsInstructions = {
|
|
|
20
21
|
directory?: string;
|
|
21
22
|
text: string;
|
|
22
23
|
};
|
|
24
|
+
/** Return Git worktrees under repos/, sorted for stable instruction capture. */
|
|
25
|
+
export declare function listRepositoryDirectories(fs: SandboxFileSystem): Promise<string[]>;
|
|
23
26
|
/** Return the only Git worktree under repos/, without guessing when ambiguous. */
|
|
24
27
|
export declare function findSingleRepositoryDirectory(fs: SandboxFileSystem): Promise<string | undefined>;
|
|
25
28
|
/** Resolve the effective root-to-cwd AGENTS.md bundle for one selected directory. */
|
|
26
29
|
export declare function resolveRepositoryInstructions(args: {
|
|
27
30
|
cwd: string;
|
|
28
31
|
fs: SandboxFileSystem;
|
|
32
|
+
maxBytes?: number;
|
|
33
|
+
}): Promise<RepositoryInstructions | undefined>;
|
|
34
|
+
/** Combine AGENTS.md bundles from one or more repository directories. */
|
|
35
|
+
export declare function mergeRepositoryInstructions(bundles: RepositoryInstructions[]): RepositoryInstructions | undefined;
|
|
36
|
+
/** Resolve AGENTS.md instructions for each selected repository directory. */
|
|
37
|
+
export declare function resolveRepositoryInstructionsForDirectories(args: {
|
|
38
|
+
directories: string[];
|
|
39
|
+
fs: SandboxFileSystem;
|
|
29
40
|
}): Promise<RepositoryInstructions | undefined>;
|
|
30
41
|
/** Render repository instructions with Codex's exact model-visible wrapper. */
|
|
31
42
|
export declare function renderAgentsInstructions(args: {
|
|
@@ -19,7 +19,7 @@ export interface SandboxTools {
|
|
|
19
19
|
execute(params: SandboxToolCall): Promise<unknown>;
|
|
20
20
|
}
|
|
21
21
|
export interface SandboxAccess {
|
|
22
|
-
/** Resolve
|
|
22
|
+
/** Resolve AGENTS.md instructions for each repository directory in the Workspace. */
|
|
23
23
|
captureRepositoryInstructions(): Promise<RepositoryInstructions | undefined>;
|
|
24
24
|
readonly tools: SandboxTools;
|
|
25
25
|
readonly workspace: SandboxWorkspace;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
import { type SandboxSession } from "@/chat/sandbox/workspace";
|
|
2
3
|
import type { Workspace } from "@/chat/workspaces/types";
|
|
4
|
+
declare const cachedSnapshotSchema: z.ZodObject<{
|
|
5
|
+
profileHash: z.ZodString;
|
|
6
|
+
snapshotId: z.ZodString;
|
|
7
|
+
runtime: z.ZodString;
|
|
8
|
+
createdAtMs: z.ZodNumber;
|
|
9
|
+
dependencyCount: z.ZodNumber;
|
|
10
|
+
buildDurationMs: z.ZodNumber;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
type CachedSnapshot = z.output<typeof cachedSnapshotSchema>;
|
|
3
13
|
export type ResolveOutcome = "no_profile" | "cache_hit" | "cache_hit_after_lock_wait" | "rebuilt" | "forced_rebuild";
|
|
4
14
|
export type RebuildReason = "cache_miss" | "floating_stale" | "force_rebuild" | "snapshot_missing";
|
|
5
15
|
/** Result of resolving the reusable snapshot for one dependency profile. */
|
|
@@ -10,8 +20,13 @@ export interface Snapshot {
|
|
|
10
20
|
cacheHit: boolean;
|
|
11
21
|
resolveOutcome: ResolveOutcome;
|
|
12
22
|
rebuildReason?: RebuildReason;
|
|
23
|
+
/** Present when the Redis registry has a concrete snapshot entry. */
|
|
24
|
+
createdAtMs?: number;
|
|
25
|
+
buildDurationMs?: number;
|
|
13
26
|
}
|
|
14
27
|
export type ProgressPhase = "resolve_start" | "cache_hit" | "waiting_for_lock" | "building_snapshot" | "build_complete";
|
|
28
|
+
/** Read one cached snapshot pointer; only a missing key is a cache miss. */
|
|
29
|
+
export declare function getCachedSnapshot(profileHash: string): Promise<CachedSnapshot | null>;
|
|
15
30
|
/** Resolve or build the reusable snapshot for the current dependency profile. */
|
|
16
31
|
export declare function resolve(params: {
|
|
17
32
|
runtime: string;
|
|
@@ -25,3 +40,4 @@ export declare function resolve(params: {
|
|
|
25
40
|
}): Promise<Snapshot>;
|
|
26
41
|
/** Identify provider errors that mean a referenced snapshot no longer exists. */
|
|
27
42
|
export declare function isMissingError(error: unknown): boolean;
|
|
43
|
+
export {};
|
|
@@ -37,6 +37,13 @@ export declare function markConversationMessage(conversation: ThreadConversation
|
|
|
37
37
|
export declare function buildConversationContext(conversation: ThreadConversationState, options?: {
|
|
38
38
|
excludeMessageId?: string;
|
|
39
39
|
}): string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Keep ambient history as one evidence-only block.
|
|
42
|
+
*
|
|
43
|
+
* When durable context already ends a thread-context envelope, append message
|
|
44
|
+
* lines inside that envelope. Otherwise wrap the new messages in one envelope.
|
|
45
|
+
*/
|
|
46
|
+
export declare function appendThreadContextMessages(baseContext: string | undefined, messageLines: string[]): string | undefined;
|
|
40
47
|
/** Return the earliest human-authored message known for a thread. */
|
|
41
48
|
export declare function getThreadTitleSourceMessage(conversation: ThreadConversationState): ConversationMessage | undefined;
|
|
42
49
|
/** Build the service that owns durable conversation memory compaction. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JuniorDatabase } from "@/db/db";
|
|
2
|
-
import type { Workspace } from "./types";
|
|
2
|
+
import type { Workspace, WorkspaceSnapshot } from "./types";
|
|
3
3
|
import { WorkspaceValidationError } from "./validation";
|
|
4
4
|
/** List Workspace recipes by stable name. */
|
|
5
5
|
export declare function listWorkspaces(db: JuniorDatabase): Promise<Workspace[]>;
|
|
@@ -19,7 +19,6 @@ export declare function createWorkspace(input: {
|
|
|
19
19
|
repos: Array<{
|
|
20
20
|
provider: string;
|
|
21
21
|
repo: string;
|
|
22
|
-
isPrimary?: boolean;
|
|
23
22
|
}>;
|
|
24
23
|
}): Promise<Workspace>;
|
|
25
24
|
/** Replace one install-wide Workspace recipe. */
|
|
@@ -29,9 +28,17 @@ export declare function updateWorkspace(id: string, input: {
|
|
|
29
28
|
repos: Array<{
|
|
30
29
|
provider: string;
|
|
31
30
|
repo: string;
|
|
32
|
-
isPrimary?: boolean;
|
|
33
31
|
}>;
|
|
34
32
|
}): Promise<Workspace | undefined>;
|
|
35
33
|
/** Delete one install-wide Workspace recipe. */
|
|
36
34
|
export declare function deleteWorkspace(id: string): Promise<boolean>;
|
|
35
|
+
/** Record the current Sandbox snapshot after a successful Workspace prepare. */
|
|
36
|
+
export declare function setWorkspaceSnapshot(workspaceId: string, snapshot: WorkspaceSnapshot): Promise<void>;
|
|
37
|
+
/** Persist dashboard snapshot facts when resolve returned a concrete entry. */
|
|
38
|
+
export declare function recordResolvedWorkspaceSnapshot(workspaceId: string, snapshot: {
|
|
39
|
+
snapshotId?: string;
|
|
40
|
+
profileHash?: string;
|
|
41
|
+
createdAtMs?: number;
|
|
42
|
+
buildDurationMs?: number;
|
|
43
|
+
}): Promise<void>;
|
|
37
44
|
export { WorkspaceValidationError };
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
export interface WorkspaceRepo {
|
|
3
3
|
provider: string;
|
|
4
4
|
repo: string;
|
|
5
|
-
|
|
5
|
+
}
|
|
6
|
+
/** Last successful Sandbox snapshot recorded for one Workspace recipe. */
|
|
7
|
+
export interface WorkspaceSnapshot {
|
|
8
|
+
id: string;
|
|
9
|
+
generatedAt: Date;
|
|
10
|
+
buildDurationMs: number;
|
|
11
|
+
profileHash: string;
|
|
6
12
|
}
|
|
7
13
|
/** Named recipe used to prepare reusable sandbox contents. */
|
|
8
14
|
export interface Workspace {
|
|
@@ -10,4 +16,5 @@ export interface Workspace {
|
|
|
10
16
|
name: string;
|
|
11
17
|
setupScript: string;
|
|
12
18
|
repos: WorkspaceRepo[];
|
|
19
|
+
snapshot: WorkspaceSnapshot | null;
|
|
13
20
|
}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
instructionProvenanceFor,
|
|
14
14
|
sanitizePostgresJson,
|
|
15
15
|
withConversationEventLock
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-JDTCQDRU.js";
|
|
17
17
|
import {
|
|
18
18
|
SANDBOX_REPOS_ROOT,
|
|
19
19
|
SANDBOX_WORKSPACE_ROOT,
|
|
@@ -24,14 +24,14 @@ import {
|
|
|
24
24
|
fenceLock,
|
|
25
25
|
getStateAdapter,
|
|
26
26
|
withLock
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-EKBVHDZO.js";
|
|
28
28
|
import {
|
|
29
29
|
botConfig,
|
|
30
30
|
completeText,
|
|
31
31
|
escapeXml,
|
|
32
32
|
resolveGatewayModel,
|
|
33
33
|
unwrapCurrentInstruction
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-AEKBVJMV.js";
|
|
35
35
|
import {
|
|
36
36
|
parseSlackMessageTs,
|
|
37
37
|
toStoredSlackActor
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
logException,
|
|
42
42
|
logWarn,
|
|
43
43
|
setSpanAttributes
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-JUFZR2LD.js";
|
|
45
45
|
|
|
46
46
|
// src/chat/turn-context-tag.ts
|
|
47
47
|
var TURN_CONTEXT_TAG = "runtime-turn-context";
|
|
@@ -72,13 +72,14 @@ function isStandaloneRuntimeContextMessage(messages, index) {
|
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
var EMBEDDED_THREAD_CONTEXT_TAGS = [
|
|
75
|
+
"thread-context",
|
|
75
76
|
"recent-thread-messages",
|
|
76
77
|
"thread-compactions",
|
|
77
78
|
"thread-transcript",
|
|
78
79
|
"thread-background"
|
|
79
80
|
];
|
|
80
81
|
var EMBEDDED_THREAD_CONTEXT_PATTERN = new RegExp(
|
|
81
|
-
`<(${EMBEDDED_THREAD_CONTEXT_TAGS.join("|")})(?:\\s[^>]*)?>[\\s\\S]
|
|
82
|
+
`<(${EMBEDDED_THREAD_CONTEXT_TAGS.join("|")})(?:\\s[^>]*)?>[\\s\\S]*</\\1>`,
|
|
82
83
|
"g"
|
|
83
84
|
);
|
|
84
85
|
function isAssistantMessage(value) {
|
|
@@ -257,15 +258,19 @@ function buildImageContextSuffix(message, conversation) {
|
|
|
257
258
|
if (summaries.length === 0) {
|
|
258
259
|
return "";
|
|
259
260
|
}
|
|
260
|
-
return ` [image context: ${summaries.join(" | ")}]`;
|
|
261
|
+
return ` [image context: ${escapeXml(summaries.join(" | "))}]`;
|
|
261
262
|
}
|
|
262
263
|
function renderConversationMessageLine(message, conversation) {
|
|
263
|
-
const displayName = conversationAuthorDisplayName(message);
|
|
264
|
-
const text =
|
|
264
|
+
const displayName = escapeXml(conversationAuthorDisplayName(message));
|
|
265
|
+
const text = escapeXml(
|
|
266
|
+
message.text.replace(/\s+/g, " ").slice(0, CONTEXT_MAX_MESSAGE_CHARS)
|
|
267
|
+
);
|
|
265
268
|
const markers = [];
|
|
266
269
|
if (message.meta?.replied === false) {
|
|
267
270
|
markers.push(
|
|
268
|
-
|
|
271
|
+
escapeXml(
|
|
272
|
+
`assistant skipped: ${message.meta?.skippedReason ?? "no-reply route"}`
|
|
273
|
+
)
|
|
269
274
|
);
|
|
270
275
|
}
|
|
271
276
|
if (message.meta?.explicitMention) {
|
|
@@ -378,7 +383,7 @@ function buildConversationContext(conversation, options = {}) {
|
|
|
378
383
|
if (lines.length > 0) {
|
|
379
384
|
lines.push("");
|
|
380
385
|
}
|
|
381
|
-
lines.push(
|
|
386
|
+
lines.push('<thread-context authority="evidence-only">');
|
|
382
387
|
for (const [index, message] of messages.entries()) {
|
|
383
388
|
const author = escapeXml(conversationAuthorDisplayName(message));
|
|
384
389
|
const actorIdAttr = message.author?.userId ? ` actor_id="${escapeXml(message.author.userId)}"` : "";
|
|
@@ -390,10 +395,33 @@ function buildConversationContext(conversation, options = {}) {
|
|
|
390
395
|
" </message>"
|
|
391
396
|
);
|
|
392
397
|
}
|
|
393
|
-
lines.push("</thread-
|
|
398
|
+
lines.push("</thread-context>");
|
|
394
399
|
}
|
|
395
400
|
return lines.join("\n");
|
|
396
401
|
}
|
|
402
|
+
var THREAD_CONTEXT_OPEN = '<thread-context authority="evidence-only">';
|
|
403
|
+
var THREAD_CONTEXT_CLOSE = "</thread-context>";
|
|
404
|
+
function appendThreadContextMessages(baseContext, messageLines) {
|
|
405
|
+
const base = baseContext?.trim();
|
|
406
|
+
if (messageLines.length === 0) {
|
|
407
|
+
return base || void 0;
|
|
408
|
+
}
|
|
409
|
+
const entryBlock = messageLines.join("\n");
|
|
410
|
+
if (!base) {
|
|
411
|
+
return [THREAD_CONTEXT_OPEN, entryBlock, THREAD_CONTEXT_CLOSE].join("\n");
|
|
412
|
+
}
|
|
413
|
+
const closeIdx = base.lastIndexOf(THREAD_CONTEXT_CLOSE);
|
|
414
|
+
if (closeIdx >= 0) {
|
|
415
|
+
const before = base.slice(0, closeIdx).replace(/\s*$/, "");
|
|
416
|
+
const after = base.slice(closeIdx);
|
|
417
|
+
return `${before}
|
|
418
|
+
${entryBlock}
|
|
419
|
+
${after}`;
|
|
420
|
+
}
|
|
421
|
+
return [base, "", THREAD_CONTEXT_OPEN, entryBlock, THREAD_CONTEXT_CLOSE].join(
|
|
422
|
+
"\n"
|
|
423
|
+
);
|
|
424
|
+
}
|
|
397
425
|
function pruneCompactions(compactions) {
|
|
398
426
|
if (compactions.length <= CONTEXT_MAX_COMPACTIONS) {
|
|
399
427
|
return compactions;
|
|
@@ -2054,9 +2082,9 @@ async function findGitRoot(fs, cwd) {
|
|
|
2054
2082
|
current = parent;
|
|
2055
2083
|
}
|
|
2056
2084
|
}
|
|
2057
|
-
async function
|
|
2085
|
+
async function listRepositoryDirectories(fs) {
|
|
2058
2086
|
if (!await directoryExists(fs, SANDBOX_REPOS_ROOT)) {
|
|
2059
|
-
return
|
|
2087
|
+
return [];
|
|
2060
2088
|
}
|
|
2061
2089
|
const entries = await fs.readdir(SANDBOX_REPOS_ROOT);
|
|
2062
2090
|
const repositories = [];
|
|
@@ -2064,12 +2092,11 @@ async function findSingleRepositoryDirectory(fs) {
|
|
|
2064
2092
|
const candidate = path2.posix.join(SANDBOX_REPOS_ROOT, entry);
|
|
2065
2093
|
if (await directoryExists(fs, candidate) && await pathExists(fs, path2.posix.join(candidate, ".git"))) {
|
|
2066
2094
|
repositories.push(candidate);
|
|
2067
|
-
if (repositories.length > 1) {
|
|
2068
|
-
return void 0;
|
|
2069
|
-
}
|
|
2070
2095
|
}
|
|
2071
2096
|
}
|
|
2072
|
-
return repositories
|
|
2097
|
+
return repositories.sort(
|
|
2098
|
+
(left, right) => left < right ? -1 : left > right ? 1 : 0
|
|
2099
|
+
);
|
|
2073
2100
|
}
|
|
2074
2101
|
async function readInstructionFile(fs, filePath) {
|
|
2075
2102
|
try {
|
|
@@ -2098,7 +2125,10 @@ async function resolveRepositoryInstructions(args) {
|
|
|
2098
2125
|
}
|
|
2099
2126
|
directories.reverse();
|
|
2100
2127
|
const sources = [];
|
|
2101
|
-
let remaining =
|
|
2128
|
+
let remaining = Math.max(
|
|
2129
|
+
0,
|
|
2130
|
+
args.maxBytes ?? MAX_REPOSITORY_INSTRUCTIONS_BYTES
|
|
2131
|
+
);
|
|
2102
2132
|
for (const directory of directories) {
|
|
2103
2133
|
if (remaining <= 0) {
|
|
2104
2134
|
break;
|
|
@@ -2116,10 +2146,67 @@ async function resolveRepositoryInstructions(args) {
|
|
|
2116
2146
|
if (sources.length === 0) {
|
|
2117
2147
|
return void 0;
|
|
2118
2148
|
}
|
|
2119
|
-
const text = sources
|
|
2149
|
+
const text = formatInstructionSources(sources);
|
|
2120
2150
|
const fingerprint = createHash2("sha256").update(JSON.stringify({ directory: args.cwd, sources })).digest("hex");
|
|
2121
2151
|
return { directory: args.cwd, fingerprint, sources, text };
|
|
2122
2152
|
}
|
|
2153
|
+
function formatInstructionSources(sources) {
|
|
2154
|
+
if (sources.length === 1) {
|
|
2155
|
+
return sources[0].content;
|
|
2156
|
+
}
|
|
2157
|
+
return sources.map(
|
|
2158
|
+
(source) => `## ${path2.posix.dirname(source.path)}
|
|
2159
|
+
|
|
2160
|
+
${source.content}`
|
|
2161
|
+
).join("\n\n");
|
|
2162
|
+
}
|
|
2163
|
+
function mergeRepositoryInstructions(bundles) {
|
|
2164
|
+
if (bundles.length === 0) {
|
|
2165
|
+
return void 0;
|
|
2166
|
+
}
|
|
2167
|
+
if (bundles.length === 1) {
|
|
2168
|
+
return bundles[0];
|
|
2169
|
+
}
|
|
2170
|
+
const sources = bundles.flatMap((bundle) => bundle.sources);
|
|
2171
|
+
const text = formatInstructionSources(sources);
|
|
2172
|
+
const fingerprint = createHash2("sha256").update(
|
|
2173
|
+
JSON.stringify({
|
|
2174
|
+
directories: bundles.map((bundle) => bundle.directory ?? null),
|
|
2175
|
+
sources
|
|
2176
|
+
})
|
|
2177
|
+
).digest("hex");
|
|
2178
|
+
return { fingerprint, sources, text };
|
|
2179
|
+
}
|
|
2180
|
+
async function resolveRepositoryInstructionsForDirectories(args) {
|
|
2181
|
+
const uniqueDirectories = [
|
|
2182
|
+
...new Set(
|
|
2183
|
+
args.directories.filter(
|
|
2184
|
+
(directory) => directory === SANDBOX_WORKSPACE_ROOT || directory.startsWith(`${SANDBOX_WORKSPACE_ROOT}/`)
|
|
2185
|
+
)
|
|
2186
|
+
)
|
|
2187
|
+
].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
|
|
2188
|
+
let remaining = MAX_REPOSITORY_INSTRUCTIONS_BYTES;
|
|
2189
|
+
const bundles = [];
|
|
2190
|
+
for (const directory of uniqueDirectories) {
|
|
2191
|
+
if (remaining <= 0) {
|
|
2192
|
+
break;
|
|
2193
|
+
}
|
|
2194
|
+
const instructions = await resolveRepositoryInstructions({
|
|
2195
|
+
cwd: directory,
|
|
2196
|
+
fs: args.fs,
|
|
2197
|
+
maxBytes: remaining
|
|
2198
|
+
});
|
|
2199
|
+
if (!instructions) {
|
|
2200
|
+
continue;
|
|
2201
|
+
}
|
|
2202
|
+
bundles.push(instructions);
|
|
2203
|
+
remaining -= instructions.sources.reduce(
|
|
2204
|
+
(total, source) => total + Buffer.byteLength(source.content, "utf8"),
|
|
2205
|
+
0
|
|
2206
|
+
);
|
|
2207
|
+
}
|
|
2208
|
+
return mergeRepositoryInstructions(bundles);
|
|
2209
|
+
}
|
|
2123
2210
|
function renderAgentsInstructions(args) {
|
|
2124
2211
|
const directory = args.directory ? ` for ${args.directory}` : "";
|
|
2125
2212
|
return `# AGENTS.md instructions${directory}
|
|
@@ -3188,6 +3275,7 @@ export {
|
|
|
3188
3275
|
turnHasReply,
|
|
3189
3276
|
markConversationMessage,
|
|
3190
3277
|
buildConversationContext,
|
|
3278
|
+
appendThreadContextMessages,
|
|
3191
3279
|
createConversationMemoryService,
|
|
3192
3280
|
isHumanConversationMessage,
|
|
3193
3281
|
getConversationMessageSlackTs,
|
|
@@ -3231,8 +3319,8 @@ export {
|
|
|
3231
3319
|
collectFiles,
|
|
3232
3320
|
AGENTS_REPLACEMENT_NOTICE,
|
|
3233
3321
|
AGENTS_REMOVAL_NOTICE,
|
|
3234
|
-
|
|
3235
|
-
|
|
3322
|
+
listRepositoryDirectories,
|
|
3323
|
+
resolveRepositoryInstructionsForDirectories,
|
|
3236
3324
|
renderAgentsInstructions,
|
|
3237
3325
|
buildAgentsInstructionsMessage,
|
|
3238
3326
|
findVisibleAgentsInstructions,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createWebAuthorization,
|
|
3
3
|
deleteWebAuthorization
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OCOGPNHA.js";
|
|
5
5
|
import {
|
|
6
6
|
appendAndEnqueueInboundMessage
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZKJO4K6M.js";
|
|
8
8
|
import {
|
|
9
9
|
buildDeliveredTurnStatePatch,
|
|
10
10
|
completeAuthPauseTurn,
|
|
@@ -12,20 +12,20 @@ import {
|
|
|
12
12
|
getTurnUserMessage,
|
|
13
13
|
processPluginTask,
|
|
14
14
|
scheduleSessionCompletedPluginTasks
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-3EZ5V7XQ.js";
|
|
16
16
|
import {
|
|
17
17
|
ConversationTurnLifecycleService,
|
|
18
18
|
coerceThreadConversationState,
|
|
19
19
|
getPersistedSandboxState,
|
|
20
20
|
getPersistedThreadState,
|
|
21
21
|
persistThreadStateById
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-DTQAMME2.js";
|
|
23
23
|
import {
|
|
24
24
|
healthReportSchema
|
|
25
25
|
} from "./chunk-UTL3MHPC.js";
|
|
26
26
|
import {
|
|
27
27
|
parseSlackThreadId
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-ABNRESX6.js";
|
|
29
29
|
import {
|
|
30
30
|
TurnInputCommitLostError,
|
|
31
31
|
abandonTurnRecord,
|
|
@@ -49,31 +49,31 @@ import {
|
|
|
49
49
|
saveTurnCheckpoint,
|
|
50
50
|
startActiveTurn,
|
|
51
51
|
upsertConversationMessage
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-22RO7IDD.js";
|
|
53
53
|
import {
|
|
54
54
|
normalizeSlackConversationId
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-WX42YNDQ.js";
|
|
56
56
|
import {
|
|
57
57
|
getConversationEventStore,
|
|
58
58
|
getConversationStore,
|
|
59
59
|
getDb
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-JDTCQDRU.js";
|
|
61
61
|
import {
|
|
62
62
|
juniorApiTokens,
|
|
63
63
|
juniorConversationParticipants,
|
|
64
64
|
juniorConversations,
|
|
65
65
|
juniorIdentities,
|
|
66
66
|
juniorUsers
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-65SNO3WK.js";
|
|
68
68
|
import {
|
|
69
69
|
getSlackBotToken
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-AEKBVJMV.js";
|
|
71
71
|
import {
|
|
72
72
|
juniorDestinations
|
|
73
73
|
} from "./chunk-VFUK3X5B.js";
|
|
74
74
|
import {
|
|
75
75
|
canExposeConversationPayload
|
|
76
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-KQ5YZGDV.js";
|
|
77
77
|
import {
|
|
78
78
|
credentialContextForActor
|
|
79
79
|
} from "./chunk-BDUENQD3.js";
|
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
logWarn,
|
|
83
83
|
setTags,
|
|
84
84
|
withLogContext
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-JUFZR2LD.js";
|
|
86
86
|
|
|
87
87
|
// src/handlers/health.ts
|
|
88
88
|
function readHealthReport() {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
appendAndEnqueueInboundMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZKJO4K6M.js";
|
|
4
4
|
import {
|
|
5
5
|
ConversationTurnLifecycleService,
|
|
6
6
|
getPersistedSandboxState,
|
|
7
7
|
getPersistedThreadState,
|
|
8
8
|
persistThreadStateById
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DTQAMME2.js";
|
|
10
10
|
import {
|
|
11
11
|
AgentInvocationBusyError,
|
|
12
12
|
AgentInvocationLimitError,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
agentBindingSchema,
|
|
16
16
|
agentInvocationSchema,
|
|
17
17
|
createAgentInvocationSchema
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-FEYQVP64.js";
|
|
19
19
|
import {
|
|
20
20
|
TurnInputCommitLostError,
|
|
21
21
|
failTurnRecord,
|
|
@@ -26,16 +26,16 @@ import {
|
|
|
26
26
|
isTurnInputCommitLostError,
|
|
27
27
|
openConversationProjection,
|
|
28
28
|
saveTurnCheckpoint
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-22RO7IDD.js";
|
|
30
30
|
import {
|
|
31
31
|
getConversationEventStore,
|
|
32
32
|
getConversationStore,
|
|
33
33
|
getSqlExecutor
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-JDTCQDRU.js";
|
|
35
35
|
import {
|
|
36
36
|
juniorAgentBindings,
|
|
37
37
|
juniorAgentInvocations
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-65SNO3WK.js";
|
|
39
39
|
|
|
40
40
|
// src/chat/agent-invocations/work.ts
|
|
41
41
|
import { z } from "zod";
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
coerceThreadConversationState,
|
|
3
3
|
getPersistedThreadState,
|
|
4
4
|
persistThreadStateById
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DTQAMME2.js";
|
|
6
6
|
import {
|
|
7
7
|
pluginTaskId,
|
|
8
8
|
pluginTaskParamsSchema,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
markTurnCompleted,
|
|
23
23
|
normalizeToolNameFromResult,
|
|
24
24
|
stripRuntimeTurnContext
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-22RO7IDD.js";
|
|
26
26
|
import {
|
|
27
27
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
28
28
|
} from "./chunk-3Y47VMHV.js";
|
|
@@ -33,25 +33,25 @@ import {
|
|
|
33
33
|
createPluginModel,
|
|
34
34
|
createPluginState,
|
|
35
35
|
getPlugins
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-WX42YNDQ.js";
|
|
37
37
|
import {
|
|
38
38
|
getConversationStore,
|
|
39
39
|
getDb,
|
|
40
40
|
sameActorIdentity
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-JDTCQDRU.js";
|
|
42
42
|
import {
|
|
43
43
|
juniorConversations,
|
|
44
44
|
juniorTaskExecutions
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-65SNO3WK.js";
|
|
46
46
|
import {
|
|
47
47
|
getStateAdapter
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-EKBVHDZO.js";
|
|
49
49
|
import {
|
|
50
50
|
ProviderError,
|
|
51
51
|
findProviderError,
|
|
52
52
|
getProviderErrorAttributes,
|
|
53
53
|
getProviderErrorUserMessage
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-AEKBVJMV.js";
|
|
55
55
|
import {
|
|
56
56
|
credentialSubjectSchema
|
|
57
57
|
} from "./chunk-BDUENQD3.js";
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
import {
|
|
62
62
|
buildTurnFailureResponse,
|
|
63
63
|
logWarn
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-JUFZR2LD.js";
|
|
65
65
|
|
|
66
66
|
// src/chat/runtime/delivered-turn-state.ts
|
|
67
67
|
function buildDeliveredTurnStatePatch(args) {
|
|
@@ -87,7 +87,7 @@ import { pluginRunContextSchema } from "@sentry/junior-plugin-api";
|
|
|
87
87
|
|
|
88
88
|
// src/chat/services/turn-session-routing.ts
|
|
89
89
|
async function resolveTurnSessionRouting(args) {
|
|
90
|
-
const conversationStore = args.conversationStore ?? (await import("./db-
|
|
90
|
+
const conversationStore = args.conversationStore ?? (await import("./db-TGZBS2CP.js")).getConversationStore();
|
|
91
91
|
const conversation = await conversationStore.get({
|
|
92
92
|
conversationId: args.conversationId
|
|
93
93
|
});
|