@sentry/junior 0.161.0 → 0.163.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.
Files changed (96) hide show
  1. package/README.md +2 -0
  2. package/dist/{agent-hooks-O75UJNC6.js → agent-hooks-6IX5CV7G.js} +10 -10
  3. package/dist/api/acp/route.d.ts +13 -0
  4. package/dist/api/locations/detail.d.ts +1 -1
  5. package/dist/api/schema/conversation.d.ts +3 -0
  6. package/dist/api/schema/location.d.ts +1 -0
  7. package/dist/api/schema/person.d.ts +1 -0
  8. package/dist/api.js +204 -403
  9. package/dist/app.d.ts +2 -2
  10. package/dist/app.js +480 -38
  11. package/dist/{catalog-runtime-Z3FHU4ZY.js → catalog-runtime-NEPZNTOM.js} +5 -5
  12. package/dist/chat/agent/sandbox.d.ts +4 -0
  13. package/dist/chat/api-turns/cancellation.d.ts +27 -0
  14. package/dist/chat/api-turns/routing.d.ts +31 -0
  15. package/dist/chat/api-turns/work.d.ts +12 -29
  16. package/dist/chat/app/conversation-work.d.ts +6 -1
  17. package/dist/chat/app/production.d.ts +2 -2
  18. package/dist/chat/conversations/history.d.ts +3 -0
  19. package/dist/chat/conversations/message-search.d.ts +6 -0
  20. package/dist/chat/conversations/turn-lifecycle.d.ts +1 -1
  21. package/dist/chat/experimental.d.ts +1 -1
  22. package/dist/chat/plugins/agent-hooks.d.ts +4 -0
  23. package/dist/chat/repository-instructions.d.ts +1 -1
  24. package/dist/chat/sandbox/paths.d.ts +1 -0
  25. package/dist/chat/sandbox/prepare-workspace.d.ts +11 -0
  26. package/dist/chat/sandbox/ref.d.ts +1 -0
  27. package/dist/chat/sandbox/sandbox.d.ts +4 -0
  28. package/dist/chat/sandbox/session.d.ts +4 -0
  29. package/dist/chat/sandbox/snapshot/profile.d.ts +4 -3
  30. package/dist/chat/sandbox/snapshot/resolve.d.ts +4 -0
  31. package/dist/chat/sandbox/workspace.d.ts +4 -0
  32. package/dist/chat/slack/tools/conversation-message-search.d.ts +9 -0
  33. package/dist/chat/tools/types.d.ts +5 -0
  34. package/dist/chat/workspaces/checkout-path.d.ts +4 -0
  35. package/dist/chat/workspaces/store.d.ts +8 -0
  36. package/dist/chat/workspaces/tools.d.ts +4 -0
  37. package/dist/chat/workspaces/types.d.ts +13 -0
  38. package/dist/{chunk-WKN4ZQTZ.js → chunk-2FBPN2Y4.js} +4 -1
  39. package/dist/{chunk-QHXT7LLF.js → chunk-2HBJQEBE.js} +1 -1
  40. package/dist/{chunk-VXFDVY4C.js → chunk-3OZNFCPR.js} +6 -6
  41. package/dist/{chunk-EAIQBR66.js → chunk-3T7RJVDJ.js} +1 -1
  42. package/dist/{chunk-DGKLYDX7.js → chunk-4P2XNVTO.js} +2 -2
  43. package/dist/{chunk-FLMD25Y5.js → chunk-ATWHPSMF.js} +40 -2
  44. package/dist/{chunk-IRHX2S46.js → chunk-BLZUFHM7.js} +1 -1
  45. package/dist/chunk-BVREIWBD.js +131 -0
  46. package/dist/{chunk-QQ7SY5IZ.js → chunk-EKGJVUVS.js} +9 -6
  47. package/dist/{chunk-ZBCLWBMV.js → chunk-FEIHINKR.js} +5 -5
  48. package/dist/{chunk-MVG5UPLM.js → chunk-GCLHNRMU.js} +1 -1
  49. package/dist/{chunk-YSWHAOPQ.js → chunk-ICJ3KCA2.js} +1 -1
  50. package/dist/{chunk-G35DUPNB.js → chunk-IIT23D3M.js} +4 -4
  51. package/dist/{chunk-OYQEO72I.js → chunk-IX4XI42N.js} +417 -136
  52. package/dist/{chunk-U2XOBFDK.js → chunk-JI5EPI3O.js} +50 -5
  53. package/dist/{chunk-IW7C5C7E.js → chunk-KD3ROG6P.js} +17 -17
  54. package/dist/{chunk-4WAZ6DGX.js → chunk-MWVQ35U6.js} +543 -164
  55. package/dist/{chunk-STZVUVMS.js → chunk-MXFL7LNZ.js} +12 -7
  56. package/dist/{chunk-HSFYTIS2.js → chunk-NL53P7PS.js} +1 -1
  57. package/dist/{chunk-6WTDZKFR.js → chunk-O4IK4O7C.js} +1 -1
  58. package/dist/{chunk-OPIJ6HY3.js → chunk-O5ZZL7IR.js} +9 -9
  59. package/dist/{chunk-CGAIDDLD.js → chunk-RK7KPI6G.js} +1 -1
  60. package/dist/{chunk-V67ORYKQ.js → chunk-RTPJRLOP.js} +9 -9
  61. package/dist/{chunk-6ILVZOF6.js → chunk-SR6WRBJW.js} +4 -4
  62. package/dist/{chunk-RULQD7OX.js → chunk-THS4CKN4.js} +46 -87
  63. package/dist/{chunk-IYFKONIL.js → chunk-TPDNZCZU.js} +1 -1
  64. package/dist/{chunk-DNSIU27S.js → chunk-TPT6EF7K.js} +1 -1
  65. package/dist/{chunk-5IDFPCON.js → chunk-VRS6WDK5.js} +1 -1
  66. package/dist/{chunk-O7JTSJPU.js → chunk-WPGYWDJR.js} +6 -6
  67. package/dist/{chunk-OY2DBUV4.js → chunk-XY2IVIAY.js} +5 -5
  68. package/dist/{chunk-RVENVPNO.js → chunk-YAUQXZVT.js} +2 -2
  69. package/dist/{chunk-WVSQ2SCS.js → chunk-ZDKTZG3G.js} +1 -1
  70. package/dist/{chunk-MNY5M7RB.js → chunk-ZF6IC27P.js} +87 -10
  71. package/dist/cli/chat.js +32 -32
  72. package/dist/cli/check.js +6 -6
  73. package/dist/cli/plugins.js +13 -13
  74. package/dist/cli/snapshot-create.js +10 -10
  75. package/dist/cli/upgrade.js +7 -7
  76. package/dist/db/schema/workspaces.d.ts +169 -0
  77. package/dist/db/schema.d.ts +169 -1
  78. package/dist/{db-KKOZRE62.js → db-6VBMHVW2.js} +7 -7
  79. package/dist/{experimental-HH6OM6UH.js → experimental-XVDOSRBS.js} +1 -1
  80. package/dist/instrumentation.js +4 -4
  81. package/dist/nitro.js +2 -2
  82. package/dist/{oauth-callback-server-5AUZDWXA.js → oauth-callback-server-5NCCUIM2.js} +24 -24
  83. package/dist/{runner-K5H5NDEC.js → runner-6ONEB6TQ.js} +13 -13
  84. package/dist/{skills-OZGPB6G4.js → skills-Y5R36UH4.js} +6 -6
  85. package/dist/spawn-RFMBQ6B3.js +37 -0
  86. package/dist/{validation-TVHCNCYL.js → validation-HLHEQDEK.js} +6 -6
  87. package/dist/version.js +1 -1
  88. package/dist/{work-DXCQMJ5U.js → work-VIEFYTFG.js} +18 -18
  89. package/dist/worker-MRSKPKQZ.js +24 -0
  90. package/migrations/0029_dizzy_barracuda.sql +19 -0
  91. package/migrations/meta/0029_snapshot.json +2709 -0
  92. package/migrations/meta/_journal.json +8 -1
  93. package/package.json +8 -5
  94. package/dist/chunk-EM225ITJ.js +0 -56
  95. package/dist/spawn-RCQSC2L5.js +0 -37
  96. package/dist/worker-24HZ5HRI.js +0 -24
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_SQL_STATEMENT_TIMEOUT_MS
3
- } from "./chunk-RVENVPNO.js";
3
+ } from "./chunk-YAUQXZVT.js";
4
4
  import {
5
5
  juniorDestinations,
6
6
  timestamptz
@@ -645,6 +645,40 @@ var juniorSchedulerRuns = pgTable16(
645
645
  ]
646
646
  );
647
647
 
648
+ // src/db/schema/workspaces.ts
649
+ import { sql as sql6 } from "drizzle-orm";
650
+ import {
651
+ boolean as boolean3,
652
+ pgTable as pgTable17,
653
+ primaryKey as primaryKey9,
654
+ text as text17,
655
+ uniqueIndex as uniqueIndex7
656
+ } from "drizzle-orm/pg-core";
657
+ var juniorWorkspaces = pgTable17(
658
+ "junior_workspaces",
659
+ {
660
+ id: text17("id").primaryKey(),
661
+ name: text17("name").notNull(),
662
+ setupScript: text17("setup_script").notNull().default(""),
663
+ createdAt: timestamptz("created_at").notNull(),
664
+ updatedAt: timestamptz("updated_at").notNull()
665
+ },
666
+ (table) => [uniqueIndex7("junior_workspaces_name_idx").on(table.name)]
667
+ );
668
+ var juniorWorkspaceRepos = pgTable17(
669
+ "junior_workspace_repos",
670
+ {
671
+ workspaceId: text17("workspace_id").notNull().references(() => juniorWorkspaces.id, { onDelete: "cascade" }),
672
+ provider: text17("provider").notNull(),
673
+ repo: text17("repo").notNull(),
674
+ isPrimary: boolean3("is_primary").notNull().default(false)
675
+ },
676
+ (table) => [
677
+ primaryKey9({ columns: [table.workspaceId, table.provider, table.repo] }),
678
+ uniqueIndex7("junior_workspace_repos_primary_idx").on(table.workspaceId).where(sql6`${table.isPrimary}`)
679
+ ]
680
+ );
681
+
648
682
  // src/db/schema.ts
649
683
  var juniorSqlSchema = {
650
684
  juniorArtifacts,
@@ -665,7 +699,9 @@ var juniorSqlSchema = {
665
699
  juniorTaskExecutions,
666
700
  juniorSchedulerRuns,
667
701
  juniorSchedulerTasks,
668
- juniorUsers
702
+ juniorUsers,
703
+ juniorWorkspaceRepos,
704
+ juniorWorkspaces
669
705
  };
670
706
 
671
707
  // src/db/neon.ts
@@ -937,5 +973,7 @@ export {
937
973
  juniorTaskExecutions,
938
974
  juniorSchedulerTasks,
939
975
  juniorSchedulerRuns,
976
+ juniorWorkspaces,
977
+ juniorWorkspaceRepos,
940
978
  createJuniorSqlExecutor
941
979
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  FUNCTION_TIMEOUT_BUFFER_SECONDS,
3
3
  getChatConfig
4
- } from "./chunk-RVENVPNO.js";
4
+ } from "./chunk-YAUQXZVT.js";
5
5
 
6
6
  // src/chat/runtime/request-deadline.ts
7
7
  import { AsyncLocalStorage } from "async_hooks";
@@ -0,0 +1,131 @@
1
+ // src/chat/sandbox/paths.ts
2
+ function normalizeWorkspaceRoot(input) {
3
+ const candidate = (input ?? "").trim();
4
+ if (!candidate) {
5
+ return "/vercel/sandbox";
6
+ }
7
+ const normalized = candidate.replace(/\/+$/, "");
8
+ return normalized.startsWith("/") ? normalized : `/${normalized}`;
9
+ }
10
+ var SANDBOX_WORKSPACE_ROOT = normalizeWorkspaceRoot(
11
+ process.env.VERCEL_SANDBOX_WORKSPACE_DIR
12
+ );
13
+ var SANDBOX_REPOS_ROOT = `${SANDBOX_WORKSPACE_ROOT}/repos`;
14
+ var SANDBOX_SKILLS_ROOT = `${SANDBOX_WORKSPACE_ROOT}/skills`;
15
+ var SANDBOX_DATA_ROOT = `${SANDBOX_WORKSPACE_ROOT}/data`;
16
+ function sandboxSkillDir(skillName) {
17
+ return `${SANDBOX_SKILLS_ROOT}/${skillName}`;
18
+ }
19
+ function sandboxSkillFile(skillName) {
20
+ return `${sandboxSkillDir(skillName)}/SKILL.md`;
21
+ }
22
+ function sandboxSkillPathResolution(skillName) {
23
+ const skillDir = sandboxSkillDir(skillName);
24
+ return `Resolve relative paths in this skill against ${skillDir}. For bash commands from this skill, cd to ${skillDir} first or use absolute paths.`;
25
+ }
26
+
27
+ // src/chat/sandbox/noninteractive-command.ts
28
+ var NON_INTERACTIVE_ENV = {
29
+ CI: "1",
30
+ TERM: "dumb",
31
+ NO_COLOR: "1",
32
+ PAGER: "cat",
33
+ GIT_PAGER: "cat",
34
+ GH_PROMPT_DISABLED: "1",
35
+ GH_NO_UPDATE_NOTIFIER: "1",
36
+ GH_NO_EXTENSION_UPDATE_NOTIFIER: "1",
37
+ GH_SPINNER_DISABLED: "1",
38
+ GIT_TERMINAL_PROMPT: "0",
39
+ GCM_INTERACTIVE: "never",
40
+ DEBIAN_FRONTEND: "noninteractive",
41
+ // Git credential isolation: prevent git from sending its own auth so the
42
+ // sandbox egress proxy's header transforms are the sole credential source.
43
+ GIT_ASKPASS: "/bin/true",
44
+ GIT_CONFIG_NOSYSTEM: "1",
45
+ GIT_CONFIG_COUNT: "2",
46
+ GIT_CONFIG_KEY_0: "credential.helper",
47
+ GIT_CONFIG_VALUE_0: "",
48
+ GIT_CONFIG_KEY_1: "http.emptyAuth",
49
+ GIT_CONFIG_VALUE_1: "true"
50
+ };
51
+ function shellQuote(value) {
52
+ return `'${value.replace(/'/g, "'\\''")}'`;
53
+ }
54
+ function buildEnvExports(options) {
55
+ const lines = [];
56
+ if (options.pathPrefix) {
57
+ lines.push(`export PATH="${options.pathPrefix}"`);
58
+ }
59
+ for (const [key, value] of Object.entries(NON_INTERACTIVE_ENV)) {
60
+ lines.push(`export ${key}=${shellQuote(value)}`);
61
+ }
62
+ for (const [key, value] of Object.entries(options.env ?? {})) {
63
+ lines.push(`export ${key}=${shellQuote(value)}`);
64
+ }
65
+ return lines;
66
+ }
67
+ function buildCommandScript(input) {
68
+ return [shellQuote(input.cmd), ...(input.args ?? []).map(shellQuote)].join(
69
+ " "
70
+ );
71
+ }
72
+ function buildNonInteractiveShellScript(script, options = {}) {
73
+ return [...buildEnvExports(options), "exec </dev/null", script].join(" && ");
74
+ }
75
+ function buildNonInteractiveCommand(input) {
76
+ return {
77
+ cmd: "bash",
78
+ args: [
79
+ input.login ? "-lc" : "-c",
80
+ buildNonInteractiveShellScript(buildCommandScript(input), {
81
+ env: input.env,
82
+ pathPrefix: input.pathPrefix
83
+ })
84
+ ]
85
+ };
86
+ }
87
+ async function runNonInteractiveCommand(sandbox, input) {
88
+ const command = {
89
+ ...buildNonInteractiveCommand(input),
90
+ ...input.cwd ? { cwd: input.cwd } : {},
91
+ ...input.signal ? { signal: input.signal } : {},
92
+ ...input.sudo !== void 0 ? { sudo: input.sudo } : {}
93
+ };
94
+ return await sandbox.runCommand(command);
95
+ }
96
+
97
+ // src/chat/sleep.ts
98
+ function sleep(ms, signal) {
99
+ if (!signal) {
100
+ return new Promise((resolve) => setTimeout(resolve, ms));
101
+ }
102
+ return new Promise((resolve, reject) => {
103
+ if (signal.aborted) {
104
+ reject(signal.reason);
105
+ return;
106
+ }
107
+ const timeoutId = setTimeout(() => {
108
+ signal.removeEventListener("abort", onAbort);
109
+ resolve();
110
+ }, ms);
111
+ const onAbort = () => {
112
+ clearTimeout(timeoutId);
113
+ reject(signal.reason);
114
+ };
115
+ signal.addEventListener("abort", onAbort, { once: true });
116
+ });
117
+ }
118
+
119
+ export {
120
+ SANDBOX_WORKSPACE_ROOT,
121
+ SANDBOX_REPOS_ROOT,
122
+ SANDBOX_SKILLS_ROOT,
123
+ SANDBOX_DATA_ROOT,
124
+ sandboxSkillDir,
125
+ sandboxSkillFile,
126
+ sandboxSkillPathResolution,
127
+ sleep,
128
+ buildCommandScript,
129
+ buildNonInteractiveShellScript,
130
+ runNonInteractiveCommand
131
+ };
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  persistConversationMessages
3
- } from "./chunk-STZVUVMS.js";
3
+ } from "./chunk-MXFL7LNZ.js";
4
4
  import {
5
5
  JUNIOR_THREAD_STATE_TTL_MS
6
6
  } from "./chunk-3Y47VMHV.js";
7
7
  import {
8
8
  getDb
9
- } from "./chunk-U2XOBFDK.js";
9
+ } from "./chunk-JI5EPI3O.js";
10
10
  import {
11
11
  juniorLocationConfigurations
12
- } from "./chunk-FLMD25Y5.js";
12
+ } from "./chunk-ATWHPSMF.js";
13
13
  import {
14
14
  getStateAdapter
15
- } from "./chunk-IYFKONIL.js";
15
+ } from "./chunk-TPDNZCZU.js";
16
16
  import {
17
17
  juniorDestinations
18
18
  } from "./chunk-VFUK3X5B.js";
@@ -20,7 +20,7 @@ import {
20
20
  isRecord,
21
21
  toOptionalNumber,
22
22
  toOptionalString
23
- } from "./chunk-DNSIU27S.js";
23
+ } from "./chunk-TPT6EF7K.js";
24
24
 
25
25
  // src/chat/conversations/turn-lifecycle.ts
26
26
  var ConversationTurnLifecycleService = class {
@@ -468,6 +468,7 @@ function buildThreadStatePayload(patch) {
468
468
  if (patch.sandboxRef !== void 0) {
469
469
  payload.app_sandbox_id = patch.sandboxRef?.id ?? "";
470
470
  payload.app_sandbox_dependency_profile_hash = patch.sandboxRef?.profileHash ?? "";
471
+ payload.app_sandbox_workspace_id = patch.sandboxRef?.workspaceId ?? "";
471
472
  }
472
473
  return payload;
473
474
  }
@@ -492,9 +493,11 @@ function getPersistedSandboxState(state) {
492
493
  const profileHash = toOptionalString(
493
494
  state.app_sandbox_dependency_profile_hash
494
495
  );
496
+ const workspaceId = toOptionalString(state.app_sandbox_workspace_id);
495
497
  return {
496
498
  id,
497
- ...profileHash ? { profileHash } : {}
499
+ ...profileHash ? { profileHash } : {},
500
+ ...workspaceId ? { workspaceId } : {}
498
501
  };
499
502
  }
500
503
  async function persistThreadState(thread, patch) {
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  ToolInputError
3
- } from "./chunk-STZVUVMS.js";
3
+ } from "./chunk-MXFL7LNZ.js";
4
4
  import {
5
5
  canRouteResourceEvents,
6
6
  getPlugins
7
- } from "./chunk-MNY5M7RB.js";
7
+ } from "./chunk-ZF6IC27P.js";
8
8
  import {
9
9
  getDb
10
- } from "./chunk-U2XOBFDK.js";
10
+ } from "./chunk-JI5EPI3O.js";
11
11
  import {
12
12
  juniorAttachments,
13
13
  juniorConversations,
@@ -15,13 +15,13 @@ import {
15
15
  juniorSchedulerRuns,
16
16
  juniorSchedulerTasks,
17
17
  juniorStats
18
- } from "./chunk-FLMD25Y5.js";
18
+ } from "./chunk-ATWHPSMF.js";
19
19
  import {
20
20
  juniorDestinations
21
21
  } from "./chunk-VFUK3X5B.js";
22
22
  import {
23
23
  logInfo
24
- } from "./chunk-DNSIU27S.js";
24
+ } from "./chunk-TPT6EF7K.js";
25
25
 
26
26
  // src/chat/event-tasks/store.ts
27
27
  import { and, asc, desc, eq, inArray, or, sql } from "drizzle-orm";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-CGAIDDLD.js";
3
+ } from "./chunk-RK7KPI6G.js";
4
4
 
5
5
  // src/chat/plugins/validation.ts
6
6
  import { isDeepStrictEqual } from "util";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-V7YE4WCP.js";
6
6
  import {
7
7
  toOptionalString
8
- } from "./chunk-DNSIU27S.js";
8
+ } from "./chunk-TPT6EF7K.js";
9
9
 
10
10
  // src/chat/slack/context.ts
11
11
  import { z } from "zod";
@@ -8,14 +8,14 @@ import {
8
8
  getConversationStore,
9
9
  parseDestination,
10
10
  sameDestination
11
- } from "./chunk-U2XOBFDK.js";
11
+ } from "./chunk-JI5EPI3O.js";
12
12
  import {
13
13
  getDefaultRedisStateAdapterFor,
14
14
  getStateAdapter
15
- } from "./chunk-IYFKONIL.js";
15
+ } from "./chunk-TPDNZCZU.js";
16
16
  import {
17
17
  getChatConfig
18
- } from "./chunk-RVENVPNO.js";
18
+ } from "./chunk-YAUQXZVT.js";
19
19
  import {
20
20
  parseStoredSlackActor
21
21
  } from "./chunk-V7YE4WCP.js";
@@ -23,7 +23,7 @@ import {
23
23
  isRecord,
24
24
  toOptionalNumber,
25
25
  toOptionalString
26
- } from "./chunk-DNSIU27S.js";
26
+ } from "./chunk-TPT6EF7K.js";
27
27
 
28
28
  // src/chat/task-execution/state.ts
29
29
  import { randomUUID } from "crypto";