@sentry/junior 0.146.0 → 0.148.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-SLJADYE5.js → agent-hooks-VAUYT6PD.js} +10 -10
- package/dist/api/conversations/access.d.ts +2 -1
- package/dist/api/conversations/archive.d.ts +3 -5
- package/dist/api/conversations/create.d.ts +6 -0
- package/dist/api/conversations/detail.d.ts +2 -295
- package/dist/api/conversations/event-list.d.ts +2 -192
- package/dist/api/conversations/list.d.ts +4 -66
- package/dist/api/conversations/routes.d.ts +1 -1
- package/dist/api/conversations/stats.d.ts +0 -54
- package/dist/api/http.d.ts +2 -6
- package/dist/api/locations/detail.d.ts +3 -111
- package/dist/api/locations/list.d.ts +0 -45
- package/dist/api/locations/query.d.ts +2 -1
- package/dist/api/locations/routes.d.ts +1 -1
- package/dist/api/people/list.d.ts +0 -29
- package/dist/api/people/profile.d.ts +2 -106
- package/dist/api/people/profile.query.d.ts +2 -1
- package/dist/api/people/routes.d.ts +1 -1
- package/dist/api/people/shared.d.ts +1 -1
- package/dist/api/people/spend.d.ts +3 -4
- package/dist/api/personal-tokens/routes.d.ts +2 -2
- package/dist/api/route.d.ts +8 -14
- package/dist/api/schema/conversation.d.ts +64 -29
- package/dist/api/schema/location.d.ts +4 -0
- package/dist/api/schema/person.d.ts +7 -3
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -1
- package/dist/api/stats.d.ts +0 -13
- package/dist/api/validation.d.ts +7 -0
- package/dist/api/viewer.d.ts +3 -0
- package/dist/api.d.ts +2 -1
- package/dist/api.js +630 -564
- package/dist/app.js +369 -309
- package/dist/{catalog-runtime-RQIMSDPR.js → catalog-runtime-WADOZVTB.js} +5 -5
- package/dist/chat/actor.d.ts +4 -1
- package/dist/chat/agent/prompt.d.ts +0 -2
- package/dist/chat/agent/request.d.ts +4 -5
- package/dist/chat/agent/resume.d.ts +1 -0
- package/dist/chat/agent/sandbox.d.ts +2 -2
- package/dist/chat/agent/tools.d.ts +0 -2
- package/dist/chat/agent-dispatch/context.d.ts +2 -2
- package/dist/chat/agent-dispatch/types.d.ts +2 -2
- package/dist/chat/agent-invocations/types.d.ts +52 -0
- package/dist/chat/api-turns/work.d.ts +103 -0
- package/dist/chat/capabilities/jr-rpc-command.d.ts +2 -2
- package/dist/chat/configuration/service.d.ts +5 -2
- package/dist/chat/configuration/sql.d.ts +9 -0
- package/dist/chat/configuration/types.d.ts +17 -13
- package/dist/chat/conversations/history.d.ts +63 -0
- package/dist/chat/conversations/projection.d.ts +10 -0
- package/dist/chat/conversations/provenance.d.ts +6 -0
- package/dist/chat/conversations/sql/actor-identity.d.ts +19 -0
- package/dist/chat/conversations/store.d.ts +1 -1
- package/dist/chat/credentials/unlink-provider.d.ts +2 -1
- package/dist/chat/credentials/user-token-store.d.ts +2 -0
- package/dist/chat/event-tasks/tool-support.d.ts +2 -0
- package/dist/chat/identities/sql.d.ts +8 -0
- package/dist/chat/logging.d.ts +2 -0
- package/dist/chat/mcp/auth-store.d.ts +0 -2
- package/dist/chat/mcp/oauth.d.ts +0 -2
- package/dist/chat/oauth-flow.d.ts +3 -1
- package/dist/chat/pi/client.d.ts +2 -0
- package/dist/chat/plugins/credential-hooks.d.ts +2 -0
- package/dist/chat/prompt.d.ts +0 -2
- package/dist/chat/resource-events/notification.d.ts +2 -1
- package/dist/chat/resource-events/store.d.ts +1 -1
- package/dist/chat/runtime/delivered-turn-state.d.ts +1 -4
- package/dist/chat/runtime/reply-executor.d.ts +1 -1
- package/dist/chat/runtime/slack-runtime.d.ts +2 -1
- package/dist/chat/runtime/thread-state.d.ts +8 -11
- package/dist/chat/runtime/turn-input.d.ts +4 -2
- package/dist/chat/runtime/turn-preparation.d.ts +11 -4
- package/dist/chat/sandbox/command-result.d.ts +2 -0
- package/dist/chat/sandbox/egress/schemas.d.ts +6 -0
- package/dist/chat/scheduled-tasks/tool-support.d.ts +7 -5
- package/dist/chat/scheduled-tasks/tools/create.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/delete.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/list.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/run-now.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/update.d.ts +4 -2
- package/dist/chat/services/mcp-auth-orchestration.d.ts +0 -3
- package/dist/chat/services/plugin-auth-orchestration.d.ts +2 -1
- package/dist/chat/services/provider-default-config.d.ts +2 -2
- package/dist/chat/services/subscribed-decision.d.ts +3 -0
- package/dist/chat/services/subscribed-reply-policy.d.ts +1 -0
- package/dist/chat/services/turn-result.d.ts +0 -3
- package/dist/chat/services/turn-router.d.ts +3 -0
- package/dist/chat/slack/assistant-thread/lifecycle.d.ts +0 -1
- package/dist/chat/slack/assistant-thread/title.d.ts +0 -3
- package/dist/chat/slack/channel.d.ts +26 -0
- package/dist/chat/slack/dispatch-turn.d.ts +2 -1
- package/dist/chat/slack/timestamp-param.d.ts +0 -2
- package/dist/chat/slack/{tools → tool-support}/canvas/api.d.ts +1 -1
- package/dist/chat/slack/tool-support/canvas/context.d.ts +11 -0
- package/dist/chat/slack/tool-support/channel-access.d.ts +42 -0
- package/dist/chat/slack/tool-support/channel-target.d.ts +27 -0
- package/dist/chat/slack/{tools → tool-support}/list/api.d.ts +8 -1
- package/dist/chat/slack/tool-support/list/params.d.ts +5 -0
- package/dist/chat/slack/tools/canvas/create.d.ts +3 -1
- package/dist/chat/slack/tools/canvas/edit.d.ts +2 -0
- package/dist/chat/slack/tools/canvas/read.d.ts +2 -0
- package/dist/chat/slack/tools/canvas/write.d.ts +2 -0
- package/dist/chat/slack/tools/{user-lookup.d.ts → channel-join.d.ts} +6 -5
- package/dist/chat/slack/tools/channel-list-messages.d.ts +5 -2
- package/dist/chat/slack/tools/conversation-message-search.d.ts +4 -8
- package/dist/chat/slack/tools/list/add-items.d.ts +4 -1
- package/dist/chat/slack/tools/list/create.d.ts +2 -0
- package/dist/chat/slack/tools/list/get-items.d.ts +5 -3
- package/dist/chat/slack/tools/list/update-item.d.ts +5 -1
- package/dist/chat/slack/tools/message-add-reaction.d.ts +3 -1
- package/dist/chat/slack/tools/public-search.d.ts +65 -2
- package/dist/chat/slack/tools/send-files.d.ts +3 -1
- package/dist/chat/slack/tools/thread-read.d.ts +4 -5
- package/dist/chat/slack/vision-cache.d.ts +5 -0
- package/dist/chat/source.d.ts +2 -0
- package/dist/chat/state/conversation.d.ts +4 -5
- package/dist/chat/task-execution/checkpoint.d.ts +1 -0
- package/dist/chat/task-execution/state.d.ts +9 -4
- package/dist/chat/task-execution/store.d.ts +3 -2
- package/dist/chat/task-execution/turn-cursor.d.ts +2 -0
- package/dist/chat/task-execution/worker.d.ts +2 -0
- package/dist/chat/tasks/read.d.ts +1 -1
- package/dist/chat/tool-support/structured-result.d.ts +1 -0
- package/dist/chat/tool-support/timed-out-tool-result.d.ts +11 -0
- package/dist/chat/tools/create-event-task.d.ts +2 -0
- package/dist/chat/tools/delete-event-task.d.ts +2 -0
- package/dist/chat/tools/handoff/tool.d.ts +2 -0
- package/dist/chat/tools/list-event-tasks.d.ts +2 -0
- package/dist/chat/tools/list-resource-event-subscriptions.d.ts +2 -0
- package/dist/chat/tools/runtime/report-progress.d.ts +2 -0
- package/dist/chat/tools/runtime/spawn-agent.d.ts +2 -0
- package/dist/chat/tools/search-conversation-events.d.ts +3 -1
- package/dist/chat/tools/search-resource-event-types.d.ts +2 -0
- package/dist/chat/tools/search-tools.d.ts +2 -0
- package/dist/chat/tools/skill/load-skill.d.ts +2 -0
- package/dist/chat/tools/skill/search-mcp-tools.d.ts +2 -0
- package/dist/chat/tools/stop-watching-resources.d.ts +2 -0
- package/dist/chat/tools/system-time.d.ts +2 -0
- package/dist/chat/tools/types.d.ts +11 -10
- package/dist/chat/tools/update-event-task.d.ts +2 -0
- package/dist/chat/tools/user-lookup.d.ts +29 -0
- package/dist/chat/tools/watch-resource-events.d.ts +4 -2
- package/dist/chat/tools/web/fetch-tool.d.ts +2 -0
- package/dist/chat/tools/web/image-generate.d.ts +2 -0
- package/dist/chat/tools/web/search.d.ts +2 -0
- package/dist/{chunk-GYEKOX7N.js → chunk-2B3PT3V2.js} +1 -1
- package/dist/{chunk-JLMVCNXL.js → chunk-45LOR4PU.js} +22 -4
- package/dist/{chunk-FGHADGIC.js → chunk-4AQZYNHM.js} +2 -2
- package/dist/{chunk-W65V465O.js → chunk-4EA2SFK2.js} +66 -4
- package/dist/{chunk-MKRIZ4VG.js → chunk-4GXJUYJV.js} +4 -2
- package/dist/{chunk-F7REGDKO.js → chunk-55F4QU2V.js} +2 -1
- package/dist/{chunk-M6ZWP4RI.js → chunk-7OEIXFC3.js} +2 -2
- package/dist/{chunk-MCFIXAV5.js → chunk-D3WPMGEX.js} +55 -37
- package/dist/{chunk-AISNSNDV.js → chunk-D6YX4NNN.js} +22 -10
- package/dist/chunk-DUY5CDAM.js +36 -0
- package/dist/{chunk-B63BF443.js → chunk-EAI67NTM.js} +9 -1
- package/dist/{chunk-FEKQHPVA.js → chunk-EINWQFXI.js} +9 -8
- package/dist/chunk-GDFF3BQG.js +136 -0
- package/dist/{chunk-X22KCSCO.js → chunk-GXYDVZKM.js} +7 -5
- package/dist/{chunk-X2WMBTS3.js → chunk-HLPLT3NY.js} +8 -5
- package/dist/{chunk-PB222GIA.js → chunk-HWQGBIH7.js} +1 -1
- package/dist/chunk-IL4EDBMV.js +566 -0
- package/dist/{chunk-HQE6EJS5.js → chunk-LAZGHEYU.js} +1 -1
- package/dist/{chunk-QG7OOKIN.js → chunk-LE5H7LMT.js} +1 -1
- package/dist/chunk-LNVEIJ2L.js +48 -0
- package/dist/{chunk-JUA6VU2Z.js → chunk-OJCP3C3J.js} +12 -23
- package/dist/{chunk-37JJDS4H.js → chunk-POSZWRGL.js} +1 -1
- package/dist/{chunk-TCEJ7XXM.js → chunk-QOWHHM3F.js} +1 -1
- package/dist/{chunk-H6U2U3EP.js → chunk-RRJV5UR5.js} +304 -65
- package/dist/{chunk-OFPYOC3M.js → chunk-ULAU5ZGU.js} +127 -120
- package/dist/{chunk-V6SRLKUB.js → chunk-V2FXMOEA.js} +2 -2
- package/dist/{chunk-GDQEU4I7.js → chunk-VCYSOXON.js} +296 -526
- package/dist/{chunk-BLETMLRX.js → chunk-VMNRXKAH.js} +1374 -989
- package/dist/{chunk-37EVZP66.js → chunk-VRHTNBA6.js} +167 -92
- package/dist/{chunk-FXDDDSPL.js → chunk-VY6W3T43.js} +4 -4
- package/dist/{chunk-ZDGHGY74.js → chunk-WCN4YSH7.js} +13 -6
- package/dist/{chunk-PH4Q3A6W.js → chunk-WOONT5ZP.js} +1 -1
- package/dist/{chunk-47OSH2ZO.js → chunk-XJ42NBP5.js} +395 -206
- package/dist/{chunk-SCGVWUZX.js → chunk-ZCHIC2GM.js} +92 -75
- package/dist/chunk-ZPL2RR7F.js +798 -0
- package/dist/cli/chat.js +33 -35
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +13 -13
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +7 -7
- package/dist/db/schema/agent-invocations.d.ts +20 -0
- package/dist/db/schema/conversation-annotations.d.ts +2 -2
- package/dist/db/schema/location-configurations.d.ts +127 -0
- package/dist/db/schema.d.ts +150 -3
- package/dist/{db-WWOMXWTT.js → db-XUKZRFFK.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-A6ZZX74U.js → oauth-callback-server-LPZMMGFI.js} +25 -26
- package/dist/{runner-KSGB2UAV.js → runner-DGKUTMPX.js} +22 -41
- package/dist/{skills-26QPWKVS.js → skills-P7YUFSXM.js} +6 -6
- package/dist/spawn-DSK3ZEVD.js +38 -0
- package/dist/{validation-OPSRGFGH.js → validation-S7U5M5NR.js} +6 -6
- package/dist/version.js +1 -1
- package/dist/{work-VMSW7STJ.js → work-GAA7TVAD.js} +18 -19
- package/dist/{worker-2JNFB7C7.js → worker-JXPJH3QB.js} +11 -10
- package/migrations/0024_misty_typhoid_mary.sql +12 -0
- package/migrations/meta/0024_snapshot.json +2275 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +6 -5
- package/dist/api/health.d.ts +0 -7
- package/dist/api/personal-tokens/create.d.ts +0 -11
- package/dist/api/personal-tokens/list.d.ts +0 -12
- package/dist/api/personal-tokens/revoke.d.ts +0 -5
- package/dist/api/plugin-reports.d.ts +0 -63
- package/dist/api/plugins.d.ts +0 -8
- package/dist/api/runtime.d.ts +0 -24
- package/dist/api/skills.d.ts +0 -6
- package/dist/chat/slack/tools/canvas/context.d.ts +0 -18
- package/dist/chat/slack/tools/channel-access.d.ts +0 -30
- package/dist/chat/state/artifacts.d.ts +0 -30
- package/dist/chat/tool-support/turn-deadline-result.d.ts +0 -3
- package/dist/chunk-HLXXQI5Q.js +0 -238
- package/dist/chunk-LVW7BLLT.js +0 -115
- package/dist/chunk-Q6QZTTLS.js +0 -55
- package/dist/chunk-QSXZ42KX.js +0 -285
- package/dist/chunk-R776HKPK.js +0 -81
- package/dist/chunk-T5GXFFLA.js +0 -67
- package/dist/spawn-5LAJXZ2P.js +0 -39
- /package/dist/chat/slack/{tools → tool-support}/canvas/markdown.d.ts +0 -0
- /package/dist/chat/slack/{tools → tool-support}/channel-capabilities.d.ts +0 -0
- /package/dist/chat/slack/{tools → tool-support}/context.d.ts +0 -0
- /package/dist/chat/slack/{tools → tool-support}/slack-message-url.d.ts +0 -0
|
@@ -169,6 +169,13 @@
|
|
|
169
169
|
"when": 1786153663118,
|
|
170
170
|
"tag": "0023_task_title_columns",
|
|
171
171
|
"breakpoints": true
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"idx": 24,
|
|
175
|
+
"version": "7",
|
|
176
|
+
"when": 1786313061094,
|
|
177
|
+
"tag": "0024_misty_typhoid_mary",
|
|
178
|
+
"breakpoints": true
|
|
172
179
|
}
|
|
173
180
|
]
|
|
174
181
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.148.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"@chat-adapter/state-redis": "4.29.0",
|
|
59
59
|
"@earendil-works/pi-agent-core": "0.82.1",
|
|
60
60
|
"@earendil-works/pi-ai": "0.82.1",
|
|
61
|
+
"@hono/zod-validator": "^0.9.0",
|
|
61
62
|
"@logtape/logtape": "^2.1.1",
|
|
62
63
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
63
64
|
"@neondatabase/serverless": "^1.1.0",
|
|
@@ -80,7 +81,7 @@
|
|
|
80
81
|
"pg": "^8.16.3",
|
|
81
82
|
"yaml": "^2.9.0",
|
|
82
83
|
"zod": "^4.4.3",
|
|
83
|
-
"@sentry/junior-plugin-api": "0.
|
|
84
|
+
"@sentry/junior-plugin-api": "0.148.0"
|
|
84
85
|
},
|
|
85
86
|
"devDependencies": {
|
|
86
87
|
"@emnapi/core": "^1.10.0",
|
|
@@ -97,9 +98,9 @@
|
|
|
97
98
|
"typescript": "^6.0.3",
|
|
98
99
|
"vercel": "^54.4.0",
|
|
99
100
|
"vitest": "^4.1.7",
|
|
100
|
-
"@sentry/junior-
|
|
101
|
-
"@sentry/junior-
|
|
102
|
-
"@sentry/junior-
|
|
101
|
+
"@sentry/junior-github": "0.148.0",
|
|
102
|
+
"@sentry/junior-testing": "0.0.0",
|
|
103
|
+
"@sentry/junior-memory": "0.148.0"
|
|
103
104
|
},
|
|
104
105
|
"scripts": {
|
|
105
106
|
"build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
|
package/dist/api/health.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** Serve Junior's authenticated health report. */
|
|
2
|
-
declare const _default: import("./route").ApiRoute<import("zod").ZodObject<{
|
|
3
|
-
status: import("zod").ZodLiteral<"ok">;
|
|
4
|
-
service: import("zod").ZodString;
|
|
5
|
-
timestamp: import("zod").ZodString;
|
|
6
|
-
}, import("zod/v4/core").$strict>>;
|
|
7
|
-
export default _default;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** Create a personal API token for the authenticated viewer. */
|
|
2
|
-
declare const _default: import("../route").ApiRoute<import("zod").ZodObject<{
|
|
3
|
-
id: import("zod").ZodString;
|
|
4
|
-
name: import("zod").ZodString;
|
|
5
|
-
tokenSuffix: import("zod").ZodString;
|
|
6
|
-
createdAt: import("zod").ZodString;
|
|
7
|
-
expiresAt: import("zod").ZodString;
|
|
8
|
-
lastUsedAt: import("zod").ZodNullable<import("zod").ZodString>;
|
|
9
|
-
token: import("zod").ZodString;
|
|
10
|
-
}, import("zod/v4/core").$strict>>;
|
|
11
|
-
export default _default;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/** List active personal API tokens owned by the authenticated viewer. */
|
|
2
|
-
declare const _default: import("../route").ApiRoute<import("zod").ZodObject<{
|
|
3
|
-
tokens: import("zod").ZodArray<import("zod").ZodObject<{
|
|
4
|
-
id: import("zod").ZodString;
|
|
5
|
-
name: import("zod").ZodString;
|
|
6
|
-
tokenSuffix: import("zod").ZodString;
|
|
7
|
-
createdAt: import("zod").ZodString;
|
|
8
|
-
expiresAt: import("zod").ZodString;
|
|
9
|
-
lastUsedAt: import("zod").ZodNullable<import("zod").ZodString>;
|
|
10
|
-
}, import("zod/v4/core").$strict>>;
|
|
11
|
-
}, import("zod/v4/core").$strict>>;
|
|
12
|
-
export default _default;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/** Serve operational reports contributed by loaded plugins. */
|
|
2
|
-
declare const _default: import("./route").ApiRoute<import("zod").ZodObject<{
|
|
3
|
-
generatedAt: import("zod").ZodString;
|
|
4
|
-
reports: import("zod").ZodArray<import("zod").ZodObject<{
|
|
5
|
-
generatedAt: import("zod").ZodOptional<import("zod").ZodString>;
|
|
6
|
-
metrics: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
7
|
-
label: import("zod").ZodString;
|
|
8
|
-
tone: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
9
|
-
warning: "warning";
|
|
10
|
-
danger: "danger";
|
|
11
|
-
good: "good";
|
|
12
|
-
neutral: "neutral";
|
|
13
|
-
}>>;
|
|
14
|
-
value: import("zod").ZodString;
|
|
15
|
-
}, import("zod/v4/core").$strict>>>;
|
|
16
|
-
recordSets: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
17
|
-
fields: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
18
|
-
key: import("zod").ZodString;
|
|
19
|
-
label: import("zod").ZodString;
|
|
20
|
-
}, import("zod/v4/core").$strict>>>;
|
|
21
|
-
emptyText: import("zod").ZodOptional<import("zod").ZodString>;
|
|
22
|
-
records: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
23
|
-
id: import("zod").ZodString;
|
|
24
|
-
tone: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
25
|
-
warning: "warning";
|
|
26
|
-
danger: "danger";
|
|
27
|
-
good: "good";
|
|
28
|
-
neutral: "neutral";
|
|
29
|
-
}>>;
|
|
30
|
-
values: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>;
|
|
31
|
-
}, import("zod/v4/core").$strict>>>;
|
|
32
|
-
title: import("zod").ZodString;
|
|
33
|
-
}, import("zod/v4/core").$strict>>>;
|
|
34
|
-
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
35
|
-
pluginName: import("zod").ZodString;
|
|
36
|
-
widgets: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
37
|
-
categories: import("zod").ZodArray<import("zod").ZodObject<{
|
|
38
|
-
id: import("zod").ZodString;
|
|
39
|
-
label: import("zod").ZodString;
|
|
40
|
-
values: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodNumber>;
|
|
41
|
-
}, import("zod/v4/core").$strict>>;
|
|
42
|
-
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
43
|
-
emptyText: import("zod").ZodOptional<import("zod").ZodString>;
|
|
44
|
-
id: import("zod").ZodString;
|
|
45
|
-
series: import("zod").ZodArray<import("zod").ZodObject<{
|
|
46
|
-
format: import("zod").ZodOptional<import("zod").ZodLiteral<"usd">>;
|
|
47
|
-
key: import("zod").ZodString;
|
|
48
|
-
label: import("zod").ZodString;
|
|
49
|
-
tone: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
50
|
-
warning: "warning";
|
|
51
|
-
danger: "danger";
|
|
52
|
-
good: "good";
|
|
53
|
-
neutral: "neutral";
|
|
54
|
-
}>>;
|
|
55
|
-
}, import("zod/v4/core").$strict>>;
|
|
56
|
-
timeRangeDays: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodLiteral<7>, import("zod").ZodLiteral<30>, import("zod").ZodLiteral<90>]>>>;
|
|
57
|
-
title: import("zod").ZodString;
|
|
58
|
-
type: import("zod").ZodLiteral<"bar_chart">;
|
|
59
|
-
}, import("zod/v4/core").$strict>>>;
|
|
60
|
-
}, import("zod/v4/core").$strict>>;
|
|
61
|
-
source: import("zod").ZodLiteral<"plugins">;
|
|
62
|
-
}, import("zod/v4/core").$strict>>;
|
|
63
|
-
export default _default;
|
package/dist/api/plugins.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** Serve safe manifest metadata for loaded plugins. */
|
|
2
|
-
declare const _default: import("./route").ApiRoute<import("zod").ZodArray<import("zod").ZodObject<{
|
|
3
|
-
configKeys: import("zod").ZodArray<import("zod").ZodString>;
|
|
4
|
-
description: import("zod").ZodString;
|
|
5
|
-
displayName: import("zod").ZodString;
|
|
6
|
-
name: import("zod").ZodString;
|
|
7
|
-
}, import("zod/v4/core").$strict>>>;
|
|
8
|
-
export default _default;
|
package/dist/api/runtime.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** Serve Junior runtime build and environment metadata. */
|
|
2
|
-
declare const _default: import("./route").ApiRoute<import("zod").ZodObject<{
|
|
3
|
-
cwd: import("zod").ZodString;
|
|
4
|
-
homeDir: import("zod").ZodString;
|
|
5
|
-
descriptionText: import("zod").ZodOptional<import("zod").ZodString>;
|
|
6
|
-
providers: import("zod").ZodArray<import("zod").ZodString>;
|
|
7
|
-
skills: import("zod").ZodArray<import("zod").ZodObject<{
|
|
8
|
-
name: import("zod").ZodString;
|
|
9
|
-
pluginProvider: import("zod").ZodOptional<import("zod").ZodString>;
|
|
10
|
-
}, import("zod/v4/core").$strict>>;
|
|
11
|
-
packagedContent: import("zod").ZodObject<{
|
|
12
|
-
packageNames: import("zod").ZodArray<import("zod").ZodString>;
|
|
13
|
-
packages: import("zod").ZodArray<import("zod").ZodObject<{
|
|
14
|
-
dir: import("zod").ZodString;
|
|
15
|
-
hasMigrationsDir: import("zod").ZodBoolean;
|
|
16
|
-
hasSkillsDir: import("zod").ZodBoolean;
|
|
17
|
-
packageName: import("zod").ZodString;
|
|
18
|
-
}, import("zod/v4/core").$strict>>;
|
|
19
|
-
manifestRoots: import("zod").ZodArray<import("zod").ZodString>;
|
|
20
|
-
skillRoots: import("zod").ZodArray<import("zod").ZodString>;
|
|
21
|
-
tracingIncludes: import("zod").ZodArray<import("zod").ZodString>;
|
|
22
|
-
}, import("zod/v4/core").$strict>;
|
|
23
|
-
}, import("zod/v4/core").$strict>>;
|
|
24
|
-
export default _default;
|
package/dist/api/skills.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/** Serve the skills discovered for the current Junior runtime. */
|
|
2
|
-
declare const _default: import("./route").ApiRoute<import("zod").ZodArray<import("zod").ZodObject<{
|
|
3
|
-
name: import("zod").ZodString;
|
|
4
|
-
pluginProvider: import("zod").ZodOptional<import("zod").ZodString>;
|
|
5
|
-
}, import("zod/v4/core").$strict>>>;
|
|
6
|
-
export default _default;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { CanvasArtifactSummary } from "@/chat/state/artifacts";
|
|
2
|
-
import type { ToolState } from "@/chat/tools/types";
|
|
3
|
-
/** Merge a created canvas into artifact state without growing context forever. */
|
|
4
|
-
export declare function mergeRecentCanvases(existing: CanvasArtifactSummary[] | undefined, created: {
|
|
5
|
-
id: string;
|
|
6
|
-
title: string;
|
|
7
|
-
url?: string;
|
|
8
|
-
}): CanvasArtifactSummary[];
|
|
9
|
-
/** Resolve model-provided canvas references before Slack API calls. */
|
|
10
|
-
export declare function resolveCanvasTarget(canvas: string): {
|
|
11
|
-
ok: true;
|
|
12
|
-
canvasId: string;
|
|
13
|
-
} | {
|
|
14
|
-
ok: false;
|
|
15
|
-
error: string;
|
|
16
|
-
};
|
|
17
|
-
/** Preserve known canvas permalinks when tools only receive an ID. */
|
|
18
|
-
export declare function storedCanvasUrl(state: ToolState, canvasId: string): string | undefined;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ConversationPrivacy } from "@/chat/conversation-privacy";
|
|
2
|
-
import type { SlackChannelId, SlackTeamId } from "@/chat/slack/ids";
|
|
3
|
-
/** Minimal persisted-visibility port for cross-conversation read gates. */
|
|
4
|
-
export interface DestinationVisibilityReader {
|
|
5
|
-
getDestinationVisibility(args: {
|
|
6
|
-
provider: string;
|
|
7
|
-
providerDestinationId: string;
|
|
8
|
-
providerTenantId?: string;
|
|
9
|
-
}): Promise<ConversationPrivacy | undefined>;
|
|
10
|
-
}
|
|
11
|
-
export type SlackChannelReadAccess = {
|
|
12
|
-
allowed: true;
|
|
13
|
-
} | {
|
|
14
|
-
allowed: false;
|
|
15
|
-
error: string;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Decide whether the model may read Slack content from a target channel.
|
|
19
|
-
*
|
|
20
|
-
* The current conversation is always readable. Any other channel requires
|
|
21
|
-
* persisted `public` visibility in the same workspace: channel-id prefixes
|
|
22
|
-
* cannot prove a channel public (modern Slack private channels also use `C`
|
|
23
|
-
* ids), so missing or private destinations fail closed.
|
|
24
|
-
*/
|
|
25
|
-
export declare function checkSlackChannelReadAccess(args: {
|
|
26
|
-
currentChannelIds: Array<SlackChannelId | undefined>;
|
|
27
|
-
store?: DestinationVisibilityReader;
|
|
28
|
-
targetChannelId: SlackChannelId;
|
|
29
|
-
teamId: SlackTeamId;
|
|
30
|
-
}): Promise<SlackChannelReadAccess>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export interface ListColumnMap {
|
|
2
|
-
titleColumnId?: string;
|
|
3
|
-
completedColumnId?: string;
|
|
4
|
-
assigneeColumnId?: string;
|
|
5
|
-
dueDateColumnId?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface CanvasArtifactSummary {
|
|
8
|
-
id: string;
|
|
9
|
-
title?: string;
|
|
10
|
-
url?: string;
|
|
11
|
-
createdAt?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface ThreadArtifactsState {
|
|
14
|
-
assistantContextChannelId?: string;
|
|
15
|
-
assistantTitle?: string;
|
|
16
|
-
assistantTitleSourceMessageId?: string;
|
|
17
|
-
lastCanvasId?: string;
|
|
18
|
-
lastCanvasUrl?: string;
|
|
19
|
-
recentCanvases?: CanvasArtifactSummary[];
|
|
20
|
-
lastListId?: string;
|
|
21
|
-
lastListUrl?: string;
|
|
22
|
-
listColumnMap?: ListColumnMap;
|
|
23
|
-
updatedAt?: string;
|
|
24
|
-
}
|
|
25
|
-
/** Safely coerce an unknown value into a ThreadArtifactsState, discarding invalid fields. */
|
|
26
|
-
export declare function coerceThreadArtifactsState(value: unknown): ThreadArtifactsState;
|
|
27
|
-
/** Wrap a partial artifact update into the storage envelope with an updatedAt timestamp. */
|
|
28
|
-
export declare function buildArtifactStatePatch(patch: Partial<ThreadArtifactsState>): {
|
|
29
|
-
artifacts: ThreadArtifactsState;
|
|
30
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { AfterToolCallResult, AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
2
|
-
/** Mark an unknown tool outcome as caused by an internal execution-slice deadline. */
|
|
3
|
-
export declare function annotateTurnDeadlineToolResult(result: AgentToolResult<unknown>): AfterToolCallResult | undefined;
|
package/dist/chunk-HLXXQI5Q.js
DELETED
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
usageSchema
|
|
3
|
-
} from "./chunk-PDO5BLNM.js";
|
|
4
|
-
|
|
5
|
-
// src/chat/conversations/structured-events.ts
|
|
6
|
-
import {
|
|
7
|
-
conversationEventPresentationSchema,
|
|
8
|
-
defineConversationEvent
|
|
9
|
-
} from "@sentry/junior-plugin-api";
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
var JUNIOR_NATIVE_EVENT_NAMESPACE = "junior";
|
|
12
|
-
var authenticationEventContentSchema = z.object({
|
|
13
|
-
accountLabel: z.string().trim().min(1).max(120).optional(),
|
|
14
|
-
actorId: z.string().min(1),
|
|
15
|
-
authorizationId: z.string().min(1).optional(),
|
|
16
|
-
provider: z.string().regex(/^[a-z][a-z0-9-]*$/),
|
|
17
|
-
providerLabel: z.string().trim().min(1).max(80).optional()
|
|
18
|
-
}).strict();
|
|
19
|
-
var agentsInstructionsUpdatedContentSchema = z.object({
|
|
20
|
-
action: z.enum(["loaded", "replaced", "cleared"]),
|
|
21
|
-
directory: z.string().trim().min(1).max(500).optional(),
|
|
22
|
-
fingerprint: z.string().trim().min(1).max(128),
|
|
23
|
-
sources: z.array(
|
|
24
|
-
z.object({
|
|
25
|
-
content: z.string().min(1).max(32 * 1024),
|
|
26
|
-
path: z.string().trim().min(1).max(500)
|
|
27
|
-
}).strict()
|
|
28
|
-
).max(32),
|
|
29
|
-
textBytes: z.number().int().nonnegative().optional()
|
|
30
|
-
}).strict();
|
|
31
|
-
function providerTitle(content) {
|
|
32
|
-
return content.providerLabel?.trim() || content.provider;
|
|
33
|
-
}
|
|
34
|
-
function agentsInstructionsTitle(action) {
|
|
35
|
-
if (action === "loaded") return "Loaded AGENTS.md";
|
|
36
|
-
if (action === "replaced") return "Updated AGENTS.md";
|
|
37
|
-
return "Cleared AGENTS.md";
|
|
38
|
-
}
|
|
39
|
-
function sourceFilename(sourcePath) {
|
|
40
|
-
return sourcePath.split("/").at(-1) || sourcePath;
|
|
41
|
-
}
|
|
42
|
-
function formatBytes(bytes) {
|
|
43
|
-
if (bytes < 1024) return `${bytes} bytes`;
|
|
44
|
-
const kilobytes = bytes / 1024;
|
|
45
|
-
return `${Number.isInteger(kilobytes) ? kilobytes : kilobytes.toFixed(1)} KB`;
|
|
46
|
-
}
|
|
47
|
-
function agentsInstructionsPreview(content) {
|
|
48
|
-
const source = content.sources[0];
|
|
49
|
-
if (!source) return void 0;
|
|
50
|
-
const filename = sourceFilename(source.path);
|
|
51
|
-
const label = content.sources.length === 1 ? filename : `${content.sources.length} AGENTS.md files`;
|
|
52
|
-
return typeof content.textBytes === "number" ? `${label} \xB7 ${formatBytes(content.textBytes)}` : label;
|
|
53
|
-
}
|
|
54
|
-
var authenticationLinkedEvent = defineConversationEvent({
|
|
55
|
-
name: "authentication_linked",
|
|
56
|
-
version: 1,
|
|
57
|
-
schema: authenticationEventContentSchema,
|
|
58
|
-
renderEvent(event) {
|
|
59
|
-
const provider = providerTitle(event);
|
|
60
|
-
return {
|
|
61
|
-
icon: "link",
|
|
62
|
-
title: `${provider} connected`,
|
|
63
|
-
...event.accountLabel ? { preview: `Connected as \`${event.accountLabel}\`` } : {},
|
|
64
|
-
details: [
|
|
65
|
-
{
|
|
66
|
-
title: `${provider} connected`,
|
|
67
|
-
...event.accountLabel ? { description: `Connected as \`${event.accountLabel}\`` } : {},
|
|
68
|
-
metadata: [event.provider]
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
var authenticationUnlinkedEvent = defineConversationEvent({
|
|
75
|
-
name: "authentication_unlinked",
|
|
76
|
-
version: 1,
|
|
77
|
-
schema: authenticationEventContentSchema,
|
|
78
|
-
renderEvent(event) {
|
|
79
|
-
const provider = providerTitle(event);
|
|
80
|
-
return {
|
|
81
|
-
icon: "key",
|
|
82
|
-
title: `${provider} disconnected`,
|
|
83
|
-
details: [
|
|
84
|
-
{
|
|
85
|
-
title: `${provider} disconnected`,
|
|
86
|
-
metadata: [event.provider]
|
|
87
|
-
}
|
|
88
|
-
]
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
var agentsInstructionsUpdatedEvent = defineConversationEvent({
|
|
93
|
-
name: "agents_instructions_updated",
|
|
94
|
-
version: 1,
|
|
95
|
-
schema: agentsInstructionsUpdatedContentSchema,
|
|
96
|
-
renderEvent(event) {
|
|
97
|
-
const title = agentsInstructionsTitle(event.action);
|
|
98
|
-
const preview = agentsInstructionsPreview(event);
|
|
99
|
-
return {
|
|
100
|
-
icon: "brain",
|
|
101
|
-
title,
|
|
102
|
-
...preview ? { preview } : {},
|
|
103
|
-
...event.sources.length > 0 ? {
|
|
104
|
-
details: event.sources.map((source) => ({
|
|
105
|
-
title: sourceFilename(source.path),
|
|
106
|
-
content: source.content
|
|
107
|
-
}))
|
|
108
|
-
} : {}
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
var NATIVE_EVENT_DEFINITIONS = [
|
|
113
|
-
authenticationLinkedEvent,
|
|
114
|
-
authenticationUnlinkedEvent,
|
|
115
|
-
agentsInstructionsUpdatedEvent
|
|
116
|
-
];
|
|
117
|
-
function getJuniorNativeEventDefinition(args) {
|
|
118
|
-
return NATIVE_EVENT_DEFINITIONS.find(
|
|
119
|
-
(definition) => definition.eventName === args.name && definition.version === args.version
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
function renderJuniorNativeConversationEvent(args) {
|
|
123
|
-
if (args.namespace !== JUNIOR_NATIVE_EVENT_NAMESPACE) return void 0;
|
|
124
|
-
const definition = getJuniorNativeEventDefinition(args);
|
|
125
|
-
if (!definition) return void 0;
|
|
126
|
-
const presentation = definition.renderEvent(definition.parse(args.content));
|
|
127
|
-
return presentation === void 0 ? void 0 : conversationEventPresentationSchema.parse(presentation);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// src/chat/usage.ts
|
|
131
|
-
var agentTurnUsageSchema = usageSchema;
|
|
132
|
-
var COMPONENT_USAGE_FIELDS = [
|
|
133
|
-
"inputTokens",
|
|
134
|
-
"outputTokens",
|
|
135
|
-
"cachedInputTokens",
|
|
136
|
-
"cacheCreationTokens"
|
|
137
|
-
];
|
|
138
|
-
var COST_COMPONENT_FIELDS = [
|
|
139
|
-
"input",
|
|
140
|
-
"output",
|
|
141
|
-
"cacheRead",
|
|
142
|
-
"cacheWrite"
|
|
143
|
-
];
|
|
144
|
-
function hasAgentTurnUsage(usage) {
|
|
145
|
-
return Boolean(
|
|
146
|
-
usage && (Object.entries(usage).some(
|
|
147
|
-
([field, value]) => field !== "cost" && typeof value === "number" && Number.isFinite(value)
|
|
148
|
-
) || Object.values(usage.cost ?? {}).some(
|
|
149
|
-
(value) => typeof value === "number" && Number.isFinite(value)
|
|
150
|
-
))
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
function getFiniteCount(value) {
|
|
154
|
-
return typeof value === "number" && Number.isFinite(value) ? Math.max(0, Math.floor(value)) : void 0;
|
|
155
|
-
}
|
|
156
|
-
function getFiniteCost(value) {
|
|
157
|
-
return typeof value === "number" && Number.isFinite(value) ? Math.max(0, value) : void 0;
|
|
158
|
-
}
|
|
159
|
-
function addCost(left, right) {
|
|
160
|
-
return Math.round(((left ?? 0) + right) * 1e12) / 1e12;
|
|
161
|
-
}
|
|
162
|
-
function getComponentTotal(usage) {
|
|
163
|
-
let total;
|
|
164
|
-
for (const field of COMPONENT_USAGE_FIELDS) {
|
|
165
|
-
const value = getFiniteCount(usage[field]);
|
|
166
|
-
if (value === void 0) continue;
|
|
167
|
-
total = (total ?? 0) + value;
|
|
168
|
-
}
|
|
169
|
-
return total;
|
|
170
|
-
}
|
|
171
|
-
function addAgentTurnUsage(...usages) {
|
|
172
|
-
const components = {};
|
|
173
|
-
let componentTotal;
|
|
174
|
-
let totalOnlyTokens;
|
|
175
|
-
let reasoningTokens;
|
|
176
|
-
const cost = {};
|
|
177
|
-
for (const usage of usages) {
|
|
178
|
-
if (!usage) continue;
|
|
179
|
-
const reasoning = getFiniteCount(usage.reasoningTokens);
|
|
180
|
-
if (reasoning !== void 0) {
|
|
181
|
-
reasoningTokens = (reasoningTokens ?? 0) + reasoning;
|
|
182
|
-
}
|
|
183
|
-
if (usage.cost) {
|
|
184
|
-
for (const field of [...COST_COMPONENT_FIELDS, "total"]) {
|
|
185
|
-
const value = getFiniteCost(usage.cost[field]);
|
|
186
|
-
if (value === void 0) continue;
|
|
187
|
-
cost[field] = addCost(cost[field], value);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
const usageComponentTotal = getComponentTotal(usage);
|
|
191
|
-
if (usageComponentTotal !== void 0) {
|
|
192
|
-
componentTotal = (componentTotal ?? 0) + usageComponentTotal;
|
|
193
|
-
for (const field of COMPONENT_USAGE_FIELDS) {
|
|
194
|
-
const value = getFiniteCount(usage[field]);
|
|
195
|
-
if (value === void 0) continue;
|
|
196
|
-
components[field] = (components[field] ?? 0) + value;
|
|
197
|
-
}
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
|
-
const totalTokens = getFiniteCount(usage.totalTokens);
|
|
201
|
-
if (totalTokens !== void 0) {
|
|
202
|
-
totalOnlyTokens = (totalOnlyTokens ?? 0) + totalTokens;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
if (totalOnlyTokens !== void 0) {
|
|
206
|
-
return {
|
|
207
|
-
totalTokens: totalOnlyTokens + (componentTotal ?? 0),
|
|
208
|
-
...reasoningTokens !== void 0 ? { reasoningTokens } : {},
|
|
209
|
-
...Object.keys(cost).length > 0 ? { cost } : {}
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
const result = {
|
|
213
|
-
...components,
|
|
214
|
-
...reasoningTokens !== void 0 ? { reasoningTokens } : {},
|
|
215
|
-
...Object.keys(cost).length > 0 ? { cost } : {}
|
|
216
|
-
};
|
|
217
|
-
return hasAgentTurnUsage(result) ? result : void 0;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// src/chat/tools/execution/tool-input-error.ts
|
|
221
|
-
var ToolInputError = class extends Error {
|
|
222
|
-
constructor(message, options) {
|
|
223
|
-
super(message, options);
|
|
224
|
-
this.name = "ToolInputError";
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
export {
|
|
229
|
-
JUNIOR_NATIVE_EVENT_NAMESPACE,
|
|
230
|
-
authenticationLinkedEvent,
|
|
231
|
-
authenticationUnlinkedEvent,
|
|
232
|
-
agentsInstructionsUpdatedEvent,
|
|
233
|
-
renderJuniorNativeConversationEvent,
|
|
234
|
-
ToolInputError,
|
|
235
|
-
agentTurnUsageSchema,
|
|
236
|
-
hasAgentTurnUsage,
|
|
237
|
-
addAgentTurnUsage
|
|
238
|
-
};
|
package/dist/chunk-LVW7BLLT.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
healthReportSchema
|
|
3
|
-
} from "./chunk-UTL3MHPC.js";
|
|
4
|
-
import {
|
|
5
|
-
parseSlackThreadId
|
|
6
|
-
} from "./chunk-PH4Q3A6W.js";
|
|
7
|
-
import {
|
|
8
|
-
normalizeSlackConversationId
|
|
9
|
-
} from "./chunk-V6SRLKUB.js";
|
|
10
|
-
|
|
11
|
-
// src/handlers/health.ts
|
|
12
|
-
function readHealthReport() {
|
|
13
|
-
return healthReportSchema.parse({
|
|
14
|
-
status: "ok",
|
|
15
|
-
service: "junior",
|
|
16
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
function GET() {
|
|
20
|
-
return Response.json(readHealthReport());
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// src/chat/slack/conversation-context.ts
|
|
24
|
-
function normalizeConversationName(type, channelName) {
|
|
25
|
-
const trimmed = channelName?.trim();
|
|
26
|
-
if (!trimmed) return void 0;
|
|
27
|
-
if (type === "public_channel" || type === "private_channel" || type === "private_channel_or_group_dm") {
|
|
28
|
-
return trimmed.startsWith("#") ? trimmed : `#${trimmed}`;
|
|
29
|
-
}
|
|
30
|
-
return trimmed;
|
|
31
|
-
}
|
|
32
|
-
function typeFromSlackChannelType(channelType) {
|
|
33
|
-
if (channelType === "channel") return "public_channel";
|
|
34
|
-
if (channelType === "group") return "private_channel";
|
|
35
|
-
if (channelType === "mpim") return "group_dm";
|
|
36
|
-
if (channelType === "im") return "direct_message";
|
|
37
|
-
return void 0;
|
|
38
|
-
}
|
|
39
|
-
function typeFromChannelId(channelId, channelName) {
|
|
40
|
-
const normalized = normalizeSlackConversationId(channelId);
|
|
41
|
-
if (!normalized) return void 0;
|
|
42
|
-
if (normalized.startsWith("C")) return "public_channel";
|
|
43
|
-
if (normalized.startsWith("D")) return "direct_message";
|
|
44
|
-
if (normalized.startsWith("G")) {
|
|
45
|
-
return channelName?.trim().startsWith("mpdm-") ? "group_dm" : "private_channel_or_group_dm";
|
|
46
|
-
}
|
|
47
|
-
return void 0;
|
|
48
|
-
}
|
|
49
|
-
function toSlackEventChannelType(channelType) {
|
|
50
|
-
if (channelType === "channel" || channelType === "group" || channelType === "mpim" || channelType === "im") {
|
|
51
|
-
return channelType;
|
|
52
|
-
}
|
|
53
|
-
return void 0;
|
|
54
|
-
}
|
|
55
|
-
function conversationVisibilityFromSlackChannelType(channelType) {
|
|
56
|
-
if (!channelType) return void 0;
|
|
57
|
-
return channelType === "channel" ? "public" : "private";
|
|
58
|
-
}
|
|
59
|
-
function resolveSlackChannelTypeFromMessage(message) {
|
|
60
|
-
const raw = message.raw;
|
|
61
|
-
if (!raw || typeof raw !== "object") {
|
|
62
|
-
return void 0;
|
|
63
|
-
}
|
|
64
|
-
const channelType = raw.channel_type;
|
|
65
|
-
return typeof channelType === "string" ? toSlackEventChannelType(channelType.trim()) : void 0;
|
|
66
|
-
}
|
|
67
|
-
function resolveSlackConversationContext(input) {
|
|
68
|
-
const type = typeFromSlackChannelType(input.channelType) ?? typeFromChannelId(input.channelId, input.channelName);
|
|
69
|
-
if (!type) return void 0;
|
|
70
|
-
const name = normalizeConversationName(type, input.channelName);
|
|
71
|
-
const visibility = conversationVisibilityFromSlackChannelType(
|
|
72
|
-
input.channelType
|
|
73
|
-
);
|
|
74
|
-
return {
|
|
75
|
-
type,
|
|
76
|
-
...name ? { name } : {},
|
|
77
|
-
...visibility ? { visibility } : {}
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function resolveSlackConversationContextFromThreadId(input) {
|
|
81
|
-
const slackThread = parseSlackThreadId(input.threadId);
|
|
82
|
-
const context = resolveSlackConversationContext({
|
|
83
|
-
channelId: slackThread?.channelId,
|
|
84
|
-
channelName: input.channelName
|
|
85
|
-
});
|
|
86
|
-
if (!context || !input.visibility) {
|
|
87
|
-
return context;
|
|
88
|
-
}
|
|
89
|
-
return {
|
|
90
|
-
...context,
|
|
91
|
-
type: input.visibility === "private" && context.type === "public_channel" ? "private_channel" : context.type,
|
|
92
|
-
visibility: input.visibility
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
function formatSlackConversationTypeLabel(type) {
|
|
96
|
-
if (type === "public_channel") return "Public Channel";
|
|
97
|
-
if (type === "private_channel") return "Private Channel";
|
|
98
|
-
if (type === "group_dm") return "Group DM";
|
|
99
|
-
if (type === "direct_message") return "Direct Message";
|
|
100
|
-
return "Private Channel or Group DM";
|
|
101
|
-
}
|
|
102
|
-
function formatSlackConversationRedactedLabel(context) {
|
|
103
|
-
if (!context) return void 0;
|
|
104
|
-
return formatSlackConversationTypeLabel(context.type);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export {
|
|
108
|
-
readHealthReport,
|
|
109
|
-
GET,
|
|
110
|
-
conversationVisibilityFromSlackChannelType,
|
|
111
|
-
resolveSlackChannelTypeFromMessage,
|
|
112
|
-
resolveSlackConversationContext,
|
|
113
|
-
resolveSlackConversationContextFromThreadId,
|
|
114
|
-
formatSlackConversationRedactedLabel
|
|
115
|
-
};
|