@sentry/junior-plugin-api 0.314.0 → 0.316.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/index.d.ts +695 -474
- package/dist/index.js +42 -18
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -24,12 +24,12 @@ export declare const objectFactsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
24
24
|
changes_requested: "changes_requested";
|
|
25
25
|
required: "required";
|
|
26
26
|
}>>;
|
|
27
|
-
checks: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
checks: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
28
28
|
passed: z.ZodNumber;
|
|
29
29
|
failed: z.ZodNumber;
|
|
30
30
|
pending: z.ZodNumber;
|
|
31
|
-
}, z.core.$strict>>;
|
|
32
|
-
mergeable: z.ZodOptional<z.ZodBoolean
|
|
31
|
+
}, z.core.$strict>, z.ZodLiteral<"pending">]>>;
|
|
32
|
+
mergeable: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"pending">]>>;
|
|
33
33
|
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
34
34
|
additions: z.ZodOptional<z.ZodNumber>;
|
|
35
35
|
deletions: z.ZodOptional<z.ZodNumber>;
|
|
@@ -318,12 +318,12 @@ export declare const objectAnnotationSchema: z.ZodObject<{
|
|
|
318
318
|
changes_requested: "changes_requested";
|
|
319
319
|
required: "required";
|
|
320
320
|
}>>;
|
|
321
|
-
checks: z.ZodOptional<z.ZodObject<{
|
|
321
|
+
checks: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
322
322
|
passed: z.ZodNumber;
|
|
323
323
|
failed: z.ZodNumber;
|
|
324
324
|
pending: z.ZodNumber;
|
|
325
|
-
}, z.core.$strict>>;
|
|
326
|
-
mergeable: z.ZodOptional<z.ZodBoolean
|
|
325
|
+
}, z.core.$strict>, z.ZodLiteral<"pending">]>>;
|
|
326
|
+
mergeable: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"pending">]>>;
|
|
327
327
|
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
328
328
|
additions: z.ZodOptional<z.ZodNumber>;
|
|
329
329
|
deletions: z.ZodOptional<z.ZodNumber>;
|
|
@@ -540,12 +540,12 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
|
|
|
540
540
|
changes_requested: "changes_requested";
|
|
541
541
|
required: "required";
|
|
542
542
|
}>>;
|
|
543
|
-
checks: z.ZodOptional<z.ZodObject<{
|
|
543
|
+
checks: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
544
544
|
passed: z.ZodNumber;
|
|
545
545
|
failed: z.ZodNumber;
|
|
546
546
|
pending: z.ZodNumber;
|
|
547
|
-
}, z.core.$strict>>;
|
|
548
|
-
mergeable: z.ZodOptional<z.ZodBoolean
|
|
547
|
+
}, z.core.$strict>, z.ZodLiteral<"pending">]>>;
|
|
548
|
+
mergeable: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"pending">]>>;
|
|
549
549
|
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
550
550
|
additions: z.ZodOptional<z.ZodNumber>;
|
|
551
551
|
deletions: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1049,6 +1049,12 @@ export declare const dispatchOptionsSchema: z.ZodObject<{
|
|
|
1049
1049
|
export interface CacheEntry<T> {
|
|
1050
1050
|
/** Omit to return the value without caching it, such as for an incomplete response. */
|
|
1051
1051
|
ttlMs?: number;
|
|
1052
|
+
/**
|
|
1053
|
+
* Keep the value for a day after its TTL, and return it when a later load
|
|
1054
|
+
* throws, such as during a provider outage. Never set it on an answer
|
|
1055
|
+
* about access: access must expire with its TTL.
|
|
1056
|
+
*/
|
|
1057
|
+
staleIfError?: boolean;
|
|
1052
1058
|
/** Must survive JSON serialization. */
|
|
1053
1059
|
value: T;
|
|
1054
1060
|
}
|
|
@@ -1061,12 +1067,32 @@ export interface CacheEntry<T> {
|
|
|
1061
1067
|
export interface PluginCache {
|
|
1062
1068
|
/**
|
|
1063
1069
|
* Return the cached value for `key`, or call `load` and cache its result.
|
|
1064
|
-
* Concurrent callers share one load. A load that throws is not cached
|
|
1070
|
+
* Concurrent callers share one load. A load that throws is not cached,
|
|
1071
|
+
* and it throws to the caller unless a `staleIfError` value is kept.
|
|
1065
1072
|
* `refresh` ignores the cached value and replaces it.
|
|
1066
1073
|
*/
|
|
1074
|
+
/**
|
|
1075
|
+
* Return the fresh cached value of `key`, or `undefined` when there is
|
|
1076
|
+
* none. It never loads, so a caller can find the misses of many keys and
|
|
1077
|
+
* load them in one provider call.
|
|
1078
|
+
*/
|
|
1079
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
1067
1080
|
getOrLoad<T>(key: string, load: () => Promise<CacheEntry<T>>, options?: {
|
|
1068
1081
|
refresh?: boolean;
|
|
1069
1082
|
}): Promise<T>;
|
|
1083
|
+
/**
|
|
1084
|
+
* Replace the cached value of `key` with the entry that `next` returns,
|
|
1085
|
+
* such as when a provider webhook carries the changed object. `next` gets
|
|
1086
|
+
* the cached value, also a stale one, or `undefined` when there is none.
|
|
1087
|
+
* Return nothing to keep the entry as it is. The entry's TTL, and its
|
|
1088
|
+
* `staleIfError` day, start again.
|
|
1089
|
+
*/
|
|
1090
|
+
update<T>(key: string, next: (current: T | undefined) => CacheEntry<T> | undefined): Promise<void>;
|
|
1091
|
+
/**
|
|
1092
|
+
* Drop the cached value of `key`, so the next read loads it, such as when
|
|
1093
|
+
* a provider webhook says that the object moved.
|
|
1094
|
+
*/
|
|
1095
|
+
delete(key: string): Promise<void>;
|
|
1070
1096
|
}
|
|
1071
1097
|
/** Runtime platform name without source or destination coordinates. */
|
|
1072
1098
|
export type Platform = z.output<typeof platformSchema>;
|
|
@@ -1476,6 +1502,11 @@ export interface PluginEgressRequest {
|
|
|
1476
1502
|
* grant classification.
|
|
1477
1503
|
*/
|
|
1478
1504
|
bodyText?: string;
|
|
1505
|
+
/**
|
|
1506
|
+
* Conversation of a Sandbox request, from its signed credential context.
|
|
1507
|
+
* Use it to limit what one Conversation spends, never to grant access.
|
|
1508
|
+
*/
|
|
1509
|
+
conversationId?: string;
|
|
1479
1510
|
/** Set for every Git `git-receive-pack` POST. */
|
|
1480
1511
|
gitPush?: PluginGitPush;
|
|
1481
1512
|
/** Set for every POST to a URL path that ends in `/graphql`. */
|
|
@@ -1673,12 +1704,12 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
|
|
|
1673
1704
|
changes_requested: "changes_requested";
|
|
1674
1705
|
required: "required";
|
|
1675
1706
|
}>>;
|
|
1676
|
-
checks: z.ZodOptional<z.ZodObject<{
|
|
1707
|
+
checks: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1677
1708
|
passed: z.ZodNumber;
|
|
1678
1709
|
failed: z.ZodNumber;
|
|
1679
1710
|
pending: z.ZodNumber;
|
|
1680
|
-
}, z.core.$strict>>;
|
|
1681
|
-
mergeable: z.ZodOptional<z.ZodBoolean
|
|
1711
|
+
}, z.core.$strict>, z.ZodLiteral<"pending">]>>;
|
|
1712
|
+
mergeable: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"pending">]>>;
|
|
1682
1713
|
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
1683
1714
|
additions: z.ZodOptional<z.ZodNumber>;
|
|
1684
1715
|
deletions: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1913,11 +1944,6 @@ export declare const conversationSidebarAnnotationSchema: z.ZodObject<{
|
|
|
1913
1944
|
title: z.ZodOptional<z.ZodString>;
|
|
1914
1945
|
url: z.ZodOptional<z.ZodString>;
|
|
1915
1946
|
imageUrl: z.ZodOptional<z.ZodString>;
|
|
1916
|
-
size: z.ZodOptional<z.ZodObject<{
|
|
1917
|
-
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
1918
|
-
additions: z.ZodOptional<z.ZodNumber>;
|
|
1919
|
-
deletions: z.ZodOptional<z.ZodNumber>;
|
|
1920
|
-
}, z.core.$strict>>;
|
|
1921
1947
|
}, z.core.$strict>;
|
|
1922
1948
|
export type ConversationSidebarAnnotation = z.output<typeof conversationSidebarAnnotationSchema>;
|
|
1923
1949
|
export interface ConversationSidebarHookContext extends PluginContext {
|
|
@@ -1929,6 +1955,113 @@ export interface ConversationSidebarResult {
|
|
|
1929
1955
|
/** Sidebar annotations in display order. Put the newest annotation first. */
|
|
1930
1956
|
annotationsByConversationId: Record<string, ConversationSidebarAnnotation[]>;
|
|
1931
1957
|
}
|
|
1958
|
+
export declare const codeChangeStateSchema: z.ZodEnum<{
|
|
1959
|
+
closed: "closed";
|
|
1960
|
+
merged: "merged";
|
|
1961
|
+
open: "open";
|
|
1962
|
+
}>;
|
|
1963
|
+
export type CodeChangeState = z.output<typeof codeChangeStateSchema>;
|
|
1964
|
+
export declare const codeChangeInputSchema: z.ZodObject<{
|
|
1965
|
+
closedAt: z.ZodOptional<z.ZodDate>;
|
|
1966
|
+
conversationIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1967
|
+
mergedAt: z.ZodOptional<z.ZodDate>;
|
|
1968
|
+
number: z.ZodNumber;
|
|
1969
|
+
openedAt: z.ZodDate;
|
|
1970
|
+
providerId: z.ZodString;
|
|
1971
|
+
repository: z.ZodObject<{
|
|
1972
|
+
name: z.ZodString;
|
|
1973
|
+
providerId: z.ZodString;
|
|
1974
|
+
}, z.core.$strict>;
|
|
1975
|
+
state: z.ZodEnum<{
|
|
1976
|
+
closed: "closed";
|
|
1977
|
+
merged: "merged";
|
|
1978
|
+
open: "open";
|
|
1979
|
+
}>;
|
|
1980
|
+
title: z.ZodOptional<z.ZodString>;
|
|
1981
|
+
updatedAt: z.ZodDate;
|
|
1982
|
+
}, z.core.$strict>;
|
|
1983
|
+
export type CodeChangeInput = z.input<typeof codeChangeInputSchema>;
|
|
1984
|
+
export declare const codeRepositoryInputSchema: z.ZodObject<{
|
|
1985
|
+
name: z.ZodString;
|
|
1986
|
+
providerId: z.ZodString;
|
|
1987
|
+
updatedAt: z.ZodDate;
|
|
1988
|
+
}, z.core.$strict>;
|
|
1989
|
+
export type CodeRepositoryInput = z.input<typeof codeRepositoryInputSchema>;
|
|
1990
|
+
export declare const codeChangeFilterSchema: z.ZodObject<{
|
|
1991
|
+
conversationIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1992
|
+
repository: z.ZodOptional<z.ZodObject<{
|
|
1993
|
+
name: z.ZodString;
|
|
1994
|
+
numbers: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
1995
|
+
}, z.core.$strict>>;
|
|
1996
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
1997
|
+
closed: "closed";
|
|
1998
|
+
merged: "merged";
|
|
1999
|
+
open: "open";
|
|
2000
|
+
}>>;
|
|
2001
|
+
updatedBefore: z.ZodOptional<z.ZodDate>;
|
|
2002
|
+
}, z.core.$strict>;
|
|
2003
|
+
export type CodeChangeFilter = z.input<typeof codeChangeFilterSchema>;
|
|
2004
|
+
/** A code change of a plugin, as Junior's code records hold it now. */
|
|
2005
|
+
export interface CodeChange {
|
|
2006
|
+
closedAt: Date | undefined;
|
|
2007
|
+
conversationIds: string[];
|
|
2008
|
+
mergedAt: Date | undefined;
|
|
2009
|
+
number: number;
|
|
2010
|
+
providerId: string;
|
|
2011
|
+
repository: {
|
|
2012
|
+
name: string;
|
|
2013
|
+
providerId: string;
|
|
2014
|
+
};
|
|
2015
|
+
state: CodeChangeState;
|
|
2016
|
+
}
|
|
2017
|
+
/** A plugin's code changes in Junior's code records. */
|
|
2018
|
+
export interface PluginCodeChanges {
|
|
2019
|
+
associateConversations(input: {
|
|
2020
|
+
conversationIds: string[];
|
|
2021
|
+
providerId: string;
|
|
2022
|
+
}): Promise<void>;
|
|
2023
|
+
/**
|
|
2024
|
+
* Credit people as requesters of an existing code change: the person Work
|
|
2025
|
+
* owners of the Turns that opened or changed it. They add to the stored
|
|
2026
|
+
* ones, and a person's code changes include the ones that credit them.
|
|
2027
|
+
*/
|
|
2028
|
+
associateRequesters(input: {
|
|
2029
|
+
identityIds: string[];
|
|
2030
|
+
providerId: string;
|
|
2031
|
+
}): Promise<void>;
|
|
2032
|
+
/**
|
|
2033
|
+
* List the code changes of this plugin that match every part of the
|
|
2034
|
+
* filter, oldest update first, in one read.
|
|
2035
|
+
*/
|
|
2036
|
+
list(filter: CodeChangeFilter): Promise<CodeChange[]>;
|
|
2037
|
+
record(input: CodeChangeInput): Promise<void>;
|
|
2038
|
+
/**
|
|
2039
|
+
* Record the name of a repository that this plugin's code changes are in.
|
|
2040
|
+
* An older update does not move the name back.
|
|
2041
|
+
*/
|
|
2042
|
+
recordRepository(input: CodeRepositoryInput): Promise<void>;
|
|
2043
|
+
/**
|
|
2044
|
+
* Record a push, review, or comment by a person on a code change. Junior
|
|
2045
|
+
* ignores activity on code changes that it did not record.
|
|
2046
|
+
*/
|
|
2047
|
+
recordActivity(input: {
|
|
2048
|
+
at: Date;
|
|
2049
|
+
number: number;
|
|
2050
|
+
repositoryProviderId: string;
|
|
2051
|
+
}): Promise<void>;
|
|
2052
|
+
}
|
|
2053
|
+
/**
|
|
2054
|
+
* Build the web pages of a code plugin's repositories and code changes from
|
|
2055
|
+
* the repository name and the code change number, so Junior does not store
|
|
2056
|
+
* them.
|
|
2057
|
+
*/
|
|
2058
|
+
export interface PluginCodeLinks {
|
|
2059
|
+
change(input: {
|
|
2060
|
+
number: number;
|
|
2061
|
+
repository: string;
|
|
2062
|
+
}): string;
|
|
2063
|
+
repository(name: string): string;
|
|
2064
|
+
}
|
|
1932
2065
|
export declare const EVENT_SUMMARY_MAX_LENGTH = 4000;
|
|
1933
2066
|
export declare const EVENT_TEXT_MAX_LENGTH = 8000;
|
|
1934
2067
|
export declare const EVENT_DATA_MAX_KEYS = 32;
|
|
@@ -2642,12 +2775,12 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
|
|
|
2642
2775
|
changes_requested: "changes_requested";
|
|
2643
2776
|
required: "required";
|
|
2644
2777
|
}>>;
|
|
2645
|
-
checks: z.ZodOptional<z.ZodObject<{
|
|
2778
|
+
checks: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
2646
2779
|
passed: z.ZodNumber;
|
|
2647
2780
|
failed: z.ZodNumber;
|
|
2648
2781
|
pending: z.ZodNumber;
|
|
2649
|
-
}, z.core.$strict>>;
|
|
2650
|
-
mergeable: z.ZodOptional<z.ZodBoolean
|
|
2782
|
+
}, z.core.$strict>, z.ZodLiteral<"pending">]>>;
|
|
2783
|
+
mergeable: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"pending">]>>;
|
|
2651
2784
|
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
2652
2785
|
additions: z.ZodOptional<z.ZodNumber>;
|
|
2653
2786
|
deletions: z.ZodOptional<z.ZodNumber>;
|
|
@@ -3004,7 +3137,7 @@ export interface PluginConversationMatch {
|
|
|
3004
3137
|
* working. idle: waits for a message. A failed Turn shows as idle.
|
|
3005
3138
|
*/
|
|
3006
3139
|
status: "pending" | "running" | "paused" | "idle";
|
|
3007
|
-
/**
|
|
3140
|
+
/** Conversation summary, when it has one. */
|
|
3008
3141
|
summary?: string;
|
|
3009
3142
|
title?: string;
|
|
3010
3143
|
/** ISO time of the latest activity. */
|
|
@@ -3073,6 +3206,8 @@ interface BaseToolRegistrationHookContext extends PluginContext {
|
|
|
3073
3206
|
* started the root. Returns nothing when nobody did.
|
|
3074
3207
|
*/
|
|
3075
3208
|
resolveWorkOwner(): Promise<PluginWorkOwner | undefined>;
|
|
3209
|
+
/** The plugin's code changes in Junior's code records. */
|
|
3210
|
+
codeChanges: PluginCodeChanges;
|
|
3076
3211
|
/** Host-owned dashboard link to this conversation, when the dashboard is enabled. */
|
|
3077
3212
|
conversationLink?: {
|
|
3078
3213
|
url: string;
|
|
@@ -3201,6 +3336,11 @@ export declare function objectLinkFilterMatches(filter: ObjectLinkFilter, url: U
|
|
|
3201
3336
|
* and then the longer match.
|
|
3202
3337
|
*/
|
|
3203
3338
|
export declare function objectLinkFilterSpecificity(filter: ObjectLinkFilter): number[];
|
|
3339
|
+
/**
|
|
3340
|
+
* What `prefetch` did for one URL. `out_of_time`: the page's time ran out
|
|
3341
|
+
* before the object loaded, so its card shows only what the cache holds.
|
|
3342
|
+
*/
|
|
3343
|
+
export type ObjectLinkPrefetchOutcome = "out_of_time";
|
|
3204
3344
|
/** Trusted host context for one link resolution. */
|
|
3205
3345
|
export interface ObjectLinkContext extends PluginContext {
|
|
3206
3346
|
/**
|
|
@@ -3245,12 +3385,24 @@ export interface ObjectLinkContext extends PluginContext {
|
|
|
3245
3385
|
* MCP.
|
|
3246
3386
|
*/
|
|
3247
3387
|
viewerMcp: PluginViewerMcp;
|
|
3388
|
+
/**
|
|
3389
|
+
* What `prefetch` returned for this URL, in `canView` and `resolve` of
|
|
3390
|
+
* the same page read. Absent in every other read, such as an Attach, so
|
|
3391
|
+
* that read asks the provider as usual.
|
|
3392
|
+
*/
|
|
3393
|
+
prefetchOutcome?: ObjectLinkPrefetchOutcome;
|
|
3248
3394
|
}
|
|
3249
3395
|
/**
|
|
3250
3396
|
* One link type of a plugin. Junior calls `canView` first, and calls
|
|
3251
3397
|
* `resolve` only when it returns true. Junior does not save the result.
|
|
3252
3398
|
*/
|
|
3253
3399
|
export interface PluginObjectLinkDefinition {
|
|
3400
|
+
/**
|
|
3401
|
+
* Set false when `resolve` reads one cache entry per object that your
|
|
3402
|
+
* webhooks keep current. Junior then keeps no card copy per viewer, so a
|
|
3403
|
+
* change shows on the next read. `canView` still runs on each read.
|
|
3404
|
+
*/
|
|
3405
|
+
cacheCards?: false;
|
|
3254
3406
|
/**
|
|
3255
3407
|
* Return whether `ctx.viewer` may see the object. Junior calls it before
|
|
3256
3408
|
* each card read and again on each Attach. Return true for a public
|
|
@@ -3264,6 +3416,16 @@ export interface PluginObjectLinkDefinition {
|
|
|
3264
3416
|
* one type, such as a GitHub issue URL that opens a pull request.
|
|
3265
3417
|
*/
|
|
3266
3418
|
objectTypes: ObjectType[];
|
|
3419
|
+
/**
|
|
3420
|
+
* Load many objects into your cache in one provider call, such as one
|
|
3421
|
+
* query for a page of links. Junior calls it once with every URL of one
|
|
3422
|
+
* resolve that this link type claims, before `canView` and `resolve` run
|
|
3423
|
+
* for each URL as usual. Write only to the cache, and never return data:
|
|
3424
|
+
* the viewer may not see every object. Return the outcome of each URL
|
|
3425
|
+
* that its card read must know about, keyed by `url.href`. Junior passes
|
|
3426
|
+
* it to that URL's `canView` and `resolve` as `ctx.prefetchOutcome`.
|
|
3427
|
+
*/
|
|
3428
|
+
prefetch?(ctx: ObjectLinkContext, urls: URL[]): Promise<ReadonlyMap<string, ObjectLinkPrefetchOutcome> | void>;
|
|
3267
3429
|
/**
|
|
3268
3430
|
* Read the card. Junior calls it only after `canView` returns true.
|
|
3269
3431
|
* Return nothing for a missing object.
|
|
@@ -3284,67 +3446,6 @@ export interface PluginObjectLinkDefinition {
|
|
|
3284
3446
|
*/
|
|
3285
3447
|
readTool?(object: ObjectAnnotation): string | undefined;
|
|
3286
3448
|
}
|
|
3287
|
-
export declare const codeChangeStateSchema: z.ZodEnum<{
|
|
3288
|
-
closed: "closed";
|
|
3289
|
-
merged: "merged";
|
|
3290
|
-
open: "open";
|
|
3291
|
-
}>;
|
|
3292
|
-
export type CodeChangeState = z.output<typeof codeChangeStateSchema>;
|
|
3293
|
-
export declare const codeChangeInputSchema: z.ZodObject<{
|
|
3294
|
-
closedAt: z.ZodOptional<z.ZodDate>;
|
|
3295
|
-
conversationIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
3296
|
-
draft: z.ZodOptional<z.ZodBoolean>;
|
|
3297
|
-
mergedAt: z.ZodOptional<z.ZodDate>;
|
|
3298
|
-
number: z.ZodNumber;
|
|
3299
|
-
openedAt: z.ZodDate;
|
|
3300
|
-
providerId: z.ZodString;
|
|
3301
|
-
repository: z.ZodObject<{
|
|
3302
|
-
name: z.ZodString;
|
|
3303
|
-
providerId: z.ZodString;
|
|
3304
|
-
}, z.core.$strict>;
|
|
3305
|
-
size: z.ZodOptional<z.ZodObject<{
|
|
3306
|
-
changedFiles: z.ZodOptional<z.ZodNumber>;
|
|
3307
|
-
additions: z.ZodOptional<z.ZodNumber>;
|
|
3308
|
-
deletions: z.ZodOptional<z.ZodNumber>;
|
|
3309
|
-
}, z.core.$strict>>;
|
|
3310
|
-
state: z.ZodEnum<{
|
|
3311
|
-
closed: "closed";
|
|
3312
|
-
merged: "merged";
|
|
3313
|
-
open: "open";
|
|
3314
|
-
}>;
|
|
3315
|
-
title: z.ZodOptional<z.ZodString>;
|
|
3316
|
-
updatedAt: z.ZodDate;
|
|
3317
|
-
}, z.core.$strict>;
|
|
3318
|
-
export type CodeChangeInput = z.input<typeof codeChangeInputSchema>;
|
|
3319
|
-
/** Write code changes from a plugin to Junior's code records. */
|
|
3320
|
-
export interface CodeChangePublisher {
|
|
3321
|
-
associateConversations(input: {
|
|
3322
|
-
conversationIds: string[];
|
|
3323
|
-
providerId: string;
|
|
3324
|
-
}): Promise<void>;
|
|
3325
|
-
record(input: CodeChangeInput): Promise<void>;
|
|
3326
|
-
/**
|
|
3327
|
-
* Record a push, review, or comment by a person on a code change. Junior
|
|
3328
|
-
* ignores activity on code changes that it did not record.
|
|
3329
|
-
*/
|
|
3330
|
-
recordActivity(input: {
|
|
3331
|
-
at: Date;
|
|
3332
|
-
number: number;
|
|
3333
|
-
repositoryProviderId: string;
|
|
3334
|
-
}): Promise<void>;
|
|
3335
|
-
}
|
|
3336
|
-
/**
|
|
3337
|
-
* Build the web pages of a code plugin's repositories and code changes from
|
|
3338
|
-
* the repository name and the code change number, so Junior does not store
|
|
3339
|
-
* them.
|
|
3340
|
-
*/
|
|
3341
|
-
export interface PluginCodeLinks {
|
|
3342
|
-
change(input: {
|
|
3343
|
-
number: number;
|
|
3344
|
-
repository: string;
|
|
3345
|
-
}): string;
|
|
3346
|
-
repository(name: string): string;
|
|
3347
|
-
}
|
|
3348
3449
|
/** Most entries in one batch, annotations and Inbox items together. */
|
|
3349
3450
|
export declare const MAX_CONVERSATION_CHANGES = 100;
|
|
3350
3451
|
/** Add or replace one annotation of this plugin on a Conversation. */
|
|
@@ -3533,8 +3634,12 @@ export declare function definePromptContext<TSchema extends z.ZodType<Record<str
|
|
|
3533
3634
|
}): (content: z.input<TSchema>) => PromptContextContribution;
|
|
3534
3635
|
/** One request-scoped plugin contribution to the model-visible user prompt. */
|
|
3535
3636
|
type UserPromptContribution = PromptMessage | PromptContextContribution;
|
|
3536
|
-
/**
|
|
3537
|
-
|
|
3637
|
+
/**
|
|
3638
|
+
* What a plugin `systemPrompt` hook gets: the platform of the system prompts
|
|
3639
|
+
* that it adds to. It has no database or cache. A plugin that needs data does
|
|
3640
|
+
* its own I/O.
|
|
3641
|
+
*/
|
|
3642
|
+
type SystemPromptBuildContext = Pick<PluginContext, "log" | "plugin"> & {
|
|
3538
3643
|
platform: Platform;
|
|
3539
3644
|
};
|
|
3540
3645
|
/** One prompt context that this plugin gave an earlier Turn. */
|
|
@@ -3835,45 +3940,371 @@ export declare function eventTriggerFiltersText(filters: readonly string[]): str
|
|
|
3835
3940
|
*/
|
|
3836
3941
|
export declare function eventTriggerText(resource: string, description: Pick<EventTriggerDescription, "events" | "filters">): string;
|
|
3837
3942
|
/**
|
|
3838
|
-
*
|
|
3839
|
-
*
|
|
3840
|
-
*
|
|
3943
|
+
* A code change title split by Conventional Commits, such as
|
|
3944
|
+
* `feat(api)!: Add retries`. The plugin that owns the code change parses it,
|
|
3945
|
+
* so the Inbox can lead with the words and show the rest as pills.
|
|
3841
3946
|
*/
|
|
3842
|
-
export
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3947
|
+
export interface InboxItemSubjectTitleParts {
|
|
3948
|
+
/** The title without its type prefix, such as `Add retries`. */
|
|
3949
|
+
text: string;
|
|
3950
|
+
/** The change type as one word, such as `Feature`. Unset when unknown. */
|
|
3951
|
+
type?: string;
|
|
3952
|
+
/** The scope, such as `api`. */
|
|
3953
|
+
scope?: string;
|
|
3954
|
+
/** The title marks a breaking change, such as with `!`. */
|
|
3955
|
+
breaking?: boolean;
|
|
3956
|
+
}
|
|
3957
|
+
/** What a plugin item is about, such as a pull request. */
|
|
3958
|
+
export interface InboxItemSubjectInput {
|
|
3959
|
+
id: string;
|
|
3960
|
+
title?: string;
|
|
3961
|
+
url?: string;
|
|
3962
|
+
/** Set only for a code change whose title follows Conventional Commits. */
|
|
3963
|
+
titleParts?: InboxItemSubjectTitleParts;
|
|
3964
|
+
}
|
|
3965
|
+
/**
|
|
3966
|
+
* An item that a plugin puts in the Inbox: a notice for information,
|
|
3967
|
+
* or an ask that waits on its assignees.
|
|
3968
|
+
*/
|
|
3969
|
+
export interface PluginReviewNotice {
|
|
3970
|
+
/**
|
|
3971
|
+
* Junior assigns the User linked to each Identity, but only when that User
|
|
3972
|
+
* is in the notice's Conversation. It leaves out the others.
|
|
3973
|
+
*/
|
|
3974
|
+
assigneeIdentityIds: string[];
|
|
3975
|
+
/** Markdown details for the person. */
|
|
3976
|
+
body: string;
|
|
3977
|
+
/**
|
|
3978
|
+
* Stable key for what the notice is about. A plugin has at most one open
|
|
3979
|
+
* item for each key.
|
|
3980
|
+
*/
|
|
3981
|
+
dedupeKey: string;
|
|
3982
|
+
/** What the notice is about, such as a pull request. Search matches `id`. */
|
|
3983
|
+
subject?: InboxItemSubjectInput;
|
|
3984
|
+
/**
|
|
3985
|
+
* For an item that waits on its assignees, name their step, such as
|
|
3986
|
+
* `Ready to merge · #946`. It is the reason that the dashboard shows.
|
|
3987
|
+
*/
|
|
3988
|
+
title: string;
|
|
3989
|
+
/**
|
|
3990
|
+
* Buttons that answer the item, in display order, such as `Resume`. An
|
|
3991
|
+
* item with choices waits on its assignees. The first click closes it as
|
|
3992
|
+
* done and calls the plugin's `inboxItemAnswered` hook with the choice.
|
|
3993
|
+
* The answer starts no Turn: the plugin does the work.
|
|
3994
|
+
*/
|
|
3995
|
+
choices?: Array<{
|
|
3996
|
+
label: string;
|
|
3997
|
+
description?: string;
|
|
3846
3998
|
}>;
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3999
|
+
/**
|
|
4000
|
+
* The assignees must act, such as merge a pull request that is ready. The
|
|
4001
|
+
* item then waits on them: its Conversation shows in their Needs you, and
|
|
4002
|
+
* it counts in their Inbox. Leave it unset for a notice that is only for
|
|
4003
|
+
* information.
|
|
4004
|
+
*/
|
|
4005
|
+
waitsOnAssignees?: boolean;
|
|
4006
|
+
}
|
|
4007
|
+
/**
|
|
4008
|
+
* Inbox items that a plugin adds and closes from its own events. Each item
|
|
4009
|
+
* belongs to one Conversation. Core owns visibility, assignment rules, and
|
|
4010
|
+
* the Slack cards.
|
|
4011
|
+
*/
|
|
4012
|
+
export interface PluginInboxItems {
|
|
4013
|
+
/** Add an open item, or replace the content of the open one with the key. */
|
|
4014
|
+
upsert(notice: PluginReviewNotice): Promise<void>;
|
|
4015
|
+
/**
|
|
4016
|
+
* Close the open item with the key. Do nothing when no item is open, such
|
|
4017
|
+
* as after a person dismissed it. Return whether an open item closed.
|
|
4018
|
+
*/
|
|
4019
|
+
close(input: {
|
|
4020
|
+
dedupeKey: string;
|
|
4021
|
+
reason: string;
|
|
4022
|
+
status: "done" | "dismissed";
|
|
4023
|
+
}): Promise<boolean>;
|
|
4024
|
+
}
|
|
4025
|
+
/** Inbox items of a plugin, for the Conversation that each item belongs to. */
|
|
4026
|
+
export interface PluginConversationInboxItems {
|
|
4027
|
+
forConversation(conversationId: string): PluginInboxItems;
|
|
4028
|
+
}
|
|
4029
|
+
/** A person picked one of the `choices` of an item that this plugin added. */
|
|
4030
|
+
export interface InboxItemAnsweredHookContext extends PluginContext {
|
|
4031
|
+
/** The label of the picked choice. */
|
|
4032
|
+
choice: string;
|
|
4033
|
+
/** Junior's native code index, as from a plugin route. */
|
|
4034
|
+
codeChanges: PluginCodeChanges;
|
|
4035
|
+
/** The Conversation that the item belongs to. */
|
|
4036
|
+
conversationId: string;
|
|
4037
|
+
/** The plugin's own dedupe key of the item. */
|
|
4038
|
+
dedupeKey: string;
|
|
4039
|
+
/** Publish events, as from a plugin route. */
|
|
4040
|
+
events: EventPublisher;
|
|
4041
|
+
/** The closed item's id. It is the same on a retry of the same answer. */
|
|
4042
|
+
itemId: string;
|
|
4043
|
+
nowMs: number;
|
|
4044
|
+
/** Inbox items, as from a plugin route. */
|
|
4045
|
+
inboxItems: PluginConversationInboxItems;
|
|
4046
|
+
state: PluginState;
|
|
4047
|
+
/** Watches of the item's Conversation. */
|
|
4048
|
+
watches: PluginConversationWatches;
|
|
4049
|
+
}
|
|
4050
|
+
/** Watches of one Conversation, for a plugin outside a tool call. */
|
|
4051
|
+
export interface PluginConversationWatches extends PluginEventToolContext {
|
|
4052
|
+
/**
|
|
4053
|
+
* Whether an active Watch of this Conversation starts a Turn for this
|
|
4054
|
+
* event type on this plugin resource. Watches of other Conversations and
|
|
4055
|
+
* event automations do not count.
|
|
4056
|
+
*/
|
|
4057
|
+
watching(input: {
|
|
4058
|
+
eventType: string;
|
|
4059
|
+
identifier: string;
|
|
4060
|
+
}): Promise<boolean>;
|
|
4061
|
+
}
|
|
4062
|
+
export interface HeartbeatHookContext extends PluginContext {
|
|
4063
|
+
agent: {
|
|
4064
|
+
dispatch(options: DispatchOptions): Promise<DispatchResult>;
|
|
4065
|
+
get(id: string): Promise<Dispatch | undefined>;
|
|
4066
|
+
/**
|
|
4067
|
+
* Start a public Conversation for one person. Each call counts toward the
|
|
4068
|
+
* dispatch limit of this heartbeat. See the route context version.
|
|
4069
|
+
*/
|
|
4070
|
+
dispatchForIdentity(options: IdentityDispatchOptions): Promise<IdentityDispatchResult>;
|
|
4071
|
+
};
|
|
4072
|
+
/** Conversation annotations, as from a plugin route. */
|
|
4073
|
+
annotations: PluginConversationAnnotations;
|
|
4074
|
+
/** Junior's native code index, as from a plugin route. */
|
|
4075
|
+
codeChanges: PluginCodeChanges;
|
|
4076
|
+
/** Annotation and Inbox item changes in one write, as from a plugin route. */
|
|
4077
|
+
conversationChanges: PluginConversationChanges;
|
|
4078
|
+
/** Host embedder bound to the configured embedding model. */
|
|
4079
|
+
embedder: PluginEmbedder;
|
|
4080
|
+
/** Publish events, as from a plugin route. */
|
|
4081
|
+
events: EventPublisher;
|
|
4082
|
+
nowMs: number;
|
|
4083
|
+
/** Inbox items, as from a plugin route. */
|
|
4084
|
+
inboxItems: PluginConversationInboxItems;
|
|
4085
|
+
state: PluginState;
|
|
4086
|
+
/** Start this plugin's tasks, as from a plugin route. */
|
|
4087
|
+
tasks: PluginTaskStarter;
|
|
4088
|
+
}
|
|
4089
|
+
export interface HeartbeatResult {
|
|
4090
|
+
dispatchCount?: number;
|
|
4091
|
+
}
|
|
4092
|
+
export interface UnfinishedWorkHookContext extends PluginContext {
|
|
4093
|
+
/** Junior's native code index, as from a plugin route. */
|
|
4094
|
+
codeChanges: PluginCodeChanges;
|
|
4095
|
+
/**
|
|
4096
|
+
* Bounded conversation candidates selected by the host, with the child
|
|
4097
|
+
* conversations of candidate roots. Work in a child counts for its root.
|
|
4098
|
+
*/
|
|
4099
|
+
conversationIds: string[];
|
|
4100
|
+
}
|
|
4101
|
+
export interface UnfinishedWorkResult {
|
|
4102
|
+
/** Candidate conversations that have plugin-owned work to finish. */
|
|
4103
|
+
conversationIds: string[];
|
|
4104
|
+
/**
|
|
4105
|
+
* Candidate conversations that have any associated plugin-owned work,
|
|
4106
|
+
* finished or unfinished. Omit when the plugin cannot distinguish assignment.
|
|
4107
|
+
*
|
|
4108
|
+
* The host uses this with unfinished work and finish times to set feed
|
|
4109
|
+
* `isPriority`. Finished assigned work stays out of Priority unless the
|
|
4110
|
+
* conversation has activity after the finish time.
|
|
4111
|
+
*/
|
|
4112
|
+
assignedConversationIds?: string[];
|
|
4113
|
+
/**
|
|
4114
|
+
* Latest time when all known work finished, keyed by conversation id.
|
|
4115
|
+
* ISO-8601 timestamps. Used with conversation activity to decide whether
|
|
4116
|
+
* finished work still belongs in Priority, and whether auto-archive may
|
|
4117
|
+
* archive the conversation for users who turned it on.
|
|
4118
|
+
*/
|
|
4119
|
+
finishedWorkAtByConversationId?: Record<string, string>;
|
|
4120
|
+
}
|
|
4121
|
+
export type PluginOperationalTone = "danger" | "good" | "neutral" | "warning";
|
|
4122
|
+
export interface PluginOperationalMetric {
|
|
4123
|
+
label: string;
|
|
4124
|
+
tone?: PluginOperationalTone;
|
|
4125
|
+
value: string;
|
|
4126
|
+
}
|
|
4127
|
+
export interface PluginOperationalField {
|
|
4128
|
+
key: string;
|
|
4129
|
+
label: string;
|
|
4130
|
+
}
|
|
4131
|
+
export interface PluginOperationalRecord {
|
|
4132
|
+
id: string;
|
|
4133
|
+
tone?: PluginOperationalTone;
|
|
4134
|
+
values: Record<string, string>;
|
|
4135
|
+
}
|
|
4136
|
+
export interface PluginOperationalRecordSet {
|
|
4137
|
+
fields?: PluginOperationalField[];
|
|
4138
|
+
emptyText?: string;
|
|
4139
|
+
records?: PluginOperationalRecord[];
|
|
4140
|
+
title: string;
|
|
4141
|
+
}
|
|
4142
|
+
export interface PluginOperationalChartSeries {
|
|
4143
|
+
format?: "usd";
|
|
4144
|
+
key: string;
|
|
4145
|
+
label: string;
|
|
4146
|
+
tone?: PluginOperationalTone;
|
|
4147
|
+
}
|
|
4148
|
+
export interface PluginOperationalChartCategory {
|
|
4149
|
+
id: string;
|
|
4150
|
+
label: string;
|
|
4151
|
+
values: Record<string, number>;
|
|
4152
|
+
}
|
|
4153
|
+
export interface PluginOperationalBarChartWidget {
|
|
4154
|
+
categories: PluginOperationalChartCategory[];
|
|
4155
|
+
description?: string;
|
|
4156
|
+
emptyText?: string;
|
|
4157
|
+
id: string;
|
|
4158
|
+
series: PluginOperationalChartSeries[];
|
|
4159
|
+
timeRangeDays?: Array<1 | 7 | 30 | 90>;
|
|
4160
|
+
title: string;
|
|
4161
|
+
type: "bar_chart";
|
|
4162
|
+
}
|
|
4163
|
+
export interface PluginOperationalReportContent {
|
|
4164
|
+
generatedAt?: string;
|
|
4165
|
+
metrics?: PluginOperationalMetric[];
|
|
4166
|
+
recordSets?: PluginOperationalRecordSet[];
|
|
4167
|
+
title?: string;
|
|
4168
|
+
widgets?: PluginOperationalBarChartWidget[];
|
|
4169
|
+
}
|
|
4170
|
+
export interface PluginOperationalReport extends PluginOperationalReportContent {
|
|
4171
|
+
pluginName: string;
|
|
4172
|
+
}
|
|
4173
|
+
export interface OperationalReportHookContext extends PluginContext {
|
|
4174
|
+
eventStats: PluginConversationEventStats;
|
|
4175
|
+
nowMs: number;
|
|
4176
|
+
state: PluginReadState;
|
|
4177
|
+
}
|
|
4178
|
+
/** Read-only context for one person-scoped plugin report on a profile page. */
|
|
4179
|
+
export interface ProfileReportHookContext extends PluginContext {
|
|
4180
|
+
nowMs: number;
|
|
4181
|
+
state: PluginReadState;
|
|
4182
|
+
/** Canonical user for the profile being viewed. */
|
|
4183
|
+
subject: User;
|
|
4184
|
+
/** Canonical user for the authenticated viewer. */
|
|
4185
|
+
viewer: User;
|
|
4186
|
+
}
|
|
4187
|
+
export type PluginRouteMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "ALL";
|
|
4188
|
+
export type PluginRouteHandler = {
|
|
4189
|
+
bivarianceHack(request: Request): Promise<Response> | Response;
|
|
4190
|
+
}["bivarianceHack"];
|
|
4191
|
+
export interface PluginRoute {
|
|
4192
|
+
handler: PluginRouteHandler;
|
|
4193
|
+
method?: PluginRouteMethod | PluginRouteMethod[];
|
|
4194
|
+
path: string;
|
|
4195
|
+
}
|
|
4196
|
+
/** Fetch-compatible plugin HTTP app mounted by Junior. */
|
|
4197
|
+
export type PluginRouteApp = {
|
|
4198
|
+
fetch(request: Request, context?: PluginApiRouteRequestContext): Promise<Response> | Response;
|
|
4199
|
+
};
|
|
4200
|
+
export interface RouteRegistrationHookContext extends PluginContext {
|
|
4201
|
+
agent: {
|
|
4202
|
+
/**
|
|
4203
|
+
* Start a public Conversation for one person, as if they sent `input` from
|
|
4204
|
+
* the dashboard. It has no Slack Destination. Core starts work only when
|
|
4205
|
+
* the person maps to exactly one current Slack member on the allowed
|
|
4206
|
+
* domains: through an Identity of this plugin's provider that the OAuth
|
|
4207
|
+
* account-linking flow linked, or through a verified email that is the
|
|
4208
|
+
* User's primary email and the member's Slack email. Otherwise it returns
|
|
4209
|
+
* `not_linked` and calls no model.
|
|
4210
|
+
*/
|
|
4211
|
+
dispatchForIdentity(options: IdentityDispatchOptions): Promise<IdentityDispatchResult>;
|
|
4212
|
+
};
|
|
4213
|
+
annotations: PluginConversationAnnotations;
|
|
4214
|
+
/** Provider-neutral boundary for Junior's native code index. */
|
|
4215
|
+
codeChanges: PluginCodeChanges;
|
|
4216
|
+
/** Annotation and Inbox item changes that readers must see together. */
|
|
4217
|
+
conversationChanges: PluginConversationChanges;
|
|
4218
|
+
/** Core-owned delivery boundary for provider webhook events. */
|
|
4219
|
+
events: EventPublisher;
|
|
4220
|
+
/** Inbox items that the plugin adds and closes from its events. */
|
|
4221
|
+
inboxItems: PluginConversationInboxItems;
|
|
4222
|
+
/** Plugin-namespaced state, the same as in heartbeats. */
|
|
4223
|
+
state: PluginState;
|
|
4224
|
+
/**
|
|
4225
|
+
* Start a task with a `payload` schema from this plugin's `tasks`. Use it
|
|
4226
|
+
* when a write fails and must run again after the route returns.
|
|
4227
|
+
*/
|
|
4228
|
+
tasks: PluginTaskStarter;
|
|
4229
|
+
users: {
|
|
4230
|
+
/**
|
|
4231
|
+
* Read one stored identity and the user it links to now, with every
|
|
4232
|
+
* identity of that user. A plugin that saved an identity id uses this to
|
|
4233
|
+
* find the person's other linked accounts later.
|
|
4234
|
+
*/
|
|
4235
|
+
readIdentity(identityId: string): Promise<{
|
|
4236
|
+
identity: Identity;
|
|
4237
|
+
user?: User;
|
|
4238
|
+
} | undefined>;
|
|
4239
|
+
};
|
|
4240
|
+
}
|
|
4241
|
+
export interface ApiRouteRegistrationHookContext extends PluginContext {
|
|
4242
|
+
conversationEvents: PluginConversationEventReader;
|
|
4243
|
+
eventStats: PluginConversationEventStats;
|
|
4244
|
+
users: {
|
|
4245
|
+
/** Resolve or create the canonical user for one verified email. */
|
|
4246
|
+
resolve(email: string): Promise<User | undefined>;
|
|
4247
|
+
};
|
|
4248
|
+
}
|
|
4249
|
+
/** Per-request context Junior passes to authenticated plugin product API routes. */
|
|
4250
|
+
export declare const pluginApiRouteRequestContextSchema: z.ZodObject<{
|
|
4251
|
+
auth: z.ZodObject<{
|
|
4252
|
+
user: z.ZodObject<{
|
|
4253
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4254
|
+
emailVerified: z.ZodOptional<z.ZodBoolean>;
|
|
4255
|
+
isAdmin: z.ZodBoolean;
|
|
4256
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4257
|
+
}, z.core.$strict>;
|
|
4258
|
+
}, z.core.$strict>;
|
|
4259
|
+
pluginName: z.ZodString;
|
|
4260
|
+
}, z.core.$strict>;
|
|
4261
|
+
export type PluginApiRouteRequestContext = z.output<typeof pluginApiRouteRequestContextSchema>;
|
|
4262
|
+
export interface SlackConversationLink {
|
|
4263
|
+
url: string;
|
|
4264
|
+
}
|
|
4265
|
+
export interface SlackConversationLinkHookContext extends PluginContext {
|
|
4266
|
+
conversationId: string;
|
|
4267
|
+
}
|
|
4268
|
+
/**
|
|
4269
|
+
* Runtime-owned provenance for a transcript message: whether it is a durable
|
|
4270
|
+
* instruction or ambient context, plus the actor identity when known. Missing
|
|
4271
|
+
* provenance on an entry means unattributed context.
|
|
4272
|
+
*/
|
|
4273
|
+
export declare const pluginRunTranscriptProvenanceSchema: z.ZodObject<{
|
|
4274
|
+
authority: z.ZodEnum<{
|
|
4275
|
+
context: "context";
|
|
4276
|
+
instruction: "instruction";
|
|
4277
|
+
}>;
|
|
4278
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4279
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4280
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4281
|
+
userId: z.ZodString;
|
|
4282
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4283
|
+
platform: z.ZodLiteral<"slack">;
|
|
4284
|
+
teamId: z.ZodString;
|
|
4285
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4286
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4287
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4288
|
+
userId: z.ZodString;
|
|
4289
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4290
|
+
platform: z.ZodLiteral<"local">;
|
|
4291
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4292
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4293
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4294
|
+
userId: z.ZodString;
|
|
4295
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4296
|
+
platform: z.ZodLiteral<"web">;
|
|
4297
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4298
|
+
platform: z.ZodLiteral<"system">;
|
|
4299
|
+
name: z.ZodString;
|
|
4300
|
+
}, z.core.$strict>], "platform">>;
|
|
4301
|
+
}, z.core.$strict>;
|
|
4302
|
+
/** One normalized transcript entry from the completed run exposed to plugin tasks. */
|
|
4303
|
+
export declare const pluginRunTranscriptEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4304
|
+
type: z.ZodLiteral<"message">;
|
|
4305
|
+
role: z.ZodEnum<{
|
|
4306
|
+
assistant: "assistant";
|
|
4307
|
+
user: "user";
|
|
3877
4308
|
}>;
|
|
3878
4309
|
text: z.ZodString;
|
|
3879
4310
|
provenance: z.ZodOptional<z.ZodObject<{
|
|
@@ -4034,367 +4465,104 @@ export declare const pluginRunContextSchema: z.ZodObject<{
|
|
|
4034
4465
|
userName: z.ZodOptional<z.ZodString>;
|
|
4035
4466
|
platform: z.ZodLiteral<"slack">;
|
|
4036
4467
|
teamId: z.ZodString;
|
|
4037
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4038
|
-
email: z.ZodOptional<z.ZodString>;
|
|
4039
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
4040
|
-
userId: z.ZodString;
|
|
4041
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
4042
|
-
platform: z.ZodLiteral<"local">;
|
|
4043
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4044
|
-
email: z.ZodOptional<z.ZodString>;
|
|
4045
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
4046
|
-
userId: z.ZodString;
|
|
4047
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
4048
|
-
platform: z.ZodLiteral<"web">;
|
|
4049
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4050
|
-
platform: z.ZodLiteral<"system">;
|
|
4051
|
-
name: z.ZodString;
|
|
4052
|
-
}, z.core.$strict>], "platform">>;
|
|
4053
|
-
}, z.core.$strict>>;
|
|
4054
|
-
isRunActor: z.ZodOptional<z.ZodBoolean>;
|
|
4055
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4056
|
-
type: z.ZodLiteral<"toolResult">;
|
|
4057
|
-
toolName: z.ZodString;
|
|
4058
|
-
isError: z.ZodBoolean;
|
|
4059
|
-
text: z.ZodOptional<z.ZodString>;
|
|
4060
|
-
}, z.core.$strict>], "type">>;
|
|
4061
|
-
}, z.core.$strict>;
|
|
4062
|
-
export type PluginRunTranscriptEntry = z.output<typeof pluginRunTranscriptEntrySchema>;
|
|
4063
|
-
export type PluginRunContext = z.output<typeof pluginRunContextSchema>;
|
|
4064
|
-
/** Runtime context passed to a plugin-owned background task. */
|
|
4065
|
-
export interface PluginTaskContext extends PluginContext {
|
|
4066
|
-
embedder: PluginEmbedder;
|
|
4067
|
-
events: PluginConversationEvents;
|
|
4068
|
-
id: string;
|
|
4069
|
-
model: PluginModel;
|
|
4070
|
-
name: string;
|
|
4071
|
-
run: {
|
|
4072
|
-
load(): Promise<PluginRunContext>;
|
|
4073
|
-
};
|
|
4074
|
-
state: PluginState;
|
|
4075
|
-
/** Events that this plugin emitted in the completed Turn, oldest first. */
|
|
4076
|
-
turnEvents: PluginTurnEventReader;
|
|
4077
|
-
}
|
|
4078
|
-
/** Plugin task handler registered by name in a plugin manifest module. */
|
|
4079
|
-
export interface PluginTaskDefinition {
|
|
4080
|
-
run(ctx: PluginTaskContext): Promise<void> | void;
|
|
4081
|
-
}
|
|
4082
|
-
/** Task handlers keyed by the plugin-owned task name. */
|
|
4083
|
-
export type PluginTasks = Record<string, PluginTaskDefinition>;
|
|
4084
|
-
/**
|
|
4085
|
-
* A code change title split by Conventional Commits, such as
|
|
4086
|
-
* `feat(api)!: Add retries`. The plugin that owns the code change parses it,
|
|
4087
|
-
* so the Inbox can lead with the words and show the rest as pills.
|
|
4088
|
-
*/
|
|
4089
|
-
export interface InboxItemSubjectTitleParts {
|
|
4090
|
-
/** The title without its type prefix, such as `Add retries`. */
|
|
4091
|
-
text: string;
|
|
4092
|
-
/** The change type as one word, such as `Feature`. Unset when unknown. */
|
|
4093
|
-
type?: string;
|
|
4094
|
-
/** The scope, such as `api`. */
|
|
4095
|
-
scope?: string;
|
|
4096
|
-
/** The title marks a breaking change, such as with `!`. */
|
|
4097
|
-
breaking?: boolean;
|
|
4098
|
-
}
|
|
4099
|
-
/** What a plugin item is about, such as a pull request. */
|
|
4100
|
-
export interface InboxItemSubjectInput {
|
|
4101
|
-
id: string;
|
|
4102
|
-
title?: string;
|
|
4103
|
-
url?: string;
|
|
4104
|
-
/** Set only for a code change whose title follows Conventional Commits. */
|
|
4105
|
-
titleParts?: InboxItemSubjectTitleParts;
|
|
4106
|
-
}
|
|
4107
|
-
/**
|
|
4108
|
-
* An item that a plugin puts in the Inbox: a notice for information,
|
|
4109
|
-
* or an ask that waits on its assignees.
|
|
4110
|
-
*/
|
|
4111
|
-
export interface PluginReviewNotice {
|
|
4112
|
-
/**
|
|
4113
|
-
* Junior assigns the User linked to each Identity, but only when that User
|
|
4114
|
-
* is in the notice's Conversation. It leaves out the others.
|
|
4115
|
-
*/
|
|
4116
|
-
assigneeIdentityIds: string[];
|
|
4117
|
-
/** Markdown details for the person. */
|
|
4118
|
-
body: string;
|
|
4119
|
-
/**
|
|
4120
|
-
* Stable key for what the notice is about. A plugin has at most one open
|
|
4121
|
-
* item for each key.
|
|
4122
|
-
*/
|
|
4123
|
-
dedupeKey: string;
|
|
4124
|
-
/** What the notice is about, such as a pull request. Search matches `id`. */
|
|
4125
|
-
subject?: InboxItemSubjectInput;
|
|
4126
|
-
/**
|
|
4127
|
-
* For an item that waits on its assignees, name their step, such as
|
|
4128
|
-
* `Ready to merge · #946`. It is the reason that the dashboard shows.
|
|
4129
|
-
*/
|
|
4130
|
-
title: string;
|
|
4131
|
-
/**
|
|
4132
|
-
* Buttons that answer the item, in display order, such as `Resume`. An
|
|
4133
|
-
* item with choices waits on its assignees. The first click closes it as
|
|
4134
|
-
* done and calls the plugin's `inboxItemAnswered` hook with the choice.
|
|
4135
|
-
* The answer starts no Turn: the plugin does the work.
|
|
4136
|
-
*/
|
|
4137
|
-
choices?: Array<{
|
|
4138
|
-
label: string;
|
|
4139
|
-
description?: string;
|
|
4140
|
-
}>;
|
|
4141
|
-
/**
|
|
4142
|
-
* The assignees must act, such as merge a pull request that is ready. The
|
|
4143
|
-
* item then waits on them: its Conversation shows in their Needs you, and
|
|
4144
|
-
* it counts in their Inbox. Leave it unset for a notice that is only for
|
|
4145
|
-
* information.
|
|
4146
|
-
*/
|
|
4147
|
-
waitsOnAssignees?: boolean;
|
|
4148
|
-
}
|
|
4149
|
-
/**
|
|
4150
|
-
* Inbox items that a plugin adds and closes from its own events. Each item
|
|
4151
|
-
* belongs to one Conversation. Core owns visibility, assignment rules, and
|
|
4152
|
-
* the Slack cards.
|
|
4153
|
-
*/
|
|
4154
|
-
export interface PluginInboxItems {
|
|
4155
|
-
/** Add an open item, or replace the content of the open one with the key. */
|
|
4156
|
-
upsert(notice: PluginReviewNotice): Promise<void>;
|
|
4157
|
-
/**
|
|
4158
|
-
* Close the open item with the key. Do nothing when no item is open, such
|
|
4159
|
-
* as after a person dismissed it. Return whether an open item closed.
|
|
4160
|
-
*/
|
|
4161
|
-
close(input: {
|
|
4162
|
-
dedupeKey: string;
|
|
4163
|
-
reason: string;
|
|
4164
|
-
status: "done" | "dismissed";
|
|
4165
|
-
}): Promise<boolean>;
|
|
4166
|
-
}
|
|
4167
|
-
/** Inbox items of a plugin, for the Conversation that each item belongs to. */
|
|
4168
|
-
export interface PluginConversationInboxItems {
|
|
4169
|
-
forConversation(conversationId: string): PluginInboxItems;
|
|
4170
|
-
}
|
|
4171
|
-
/** A person picked one of the `choices` of an item that this plugin added. */
|
|
4172
|
-
export interface InboxItemAnsweredHookContext extends PluginContext {
|
|
4173
|
-
/** The label of the picked choice. */
|
|
4174
|
-
choice: string;
|
|
4175
|
-
/** The Conversation that the item belongs to. */
|
|
4176
|
-
conversationId: string;
|
|
4177
|
-
/** The plugin's own dedupe key of the item. */
|
|
4178
|
-
dedupeKey: string;
|
|
4179
|
-
/** Publish events, as from a plugin route. */
|
|
4180
|
-
events: EventPublisher;
|
|
4181
|
-
/** The closed item's id. It is the same on a retry of the same answer. */
|
|
4182
|
-
itemId: string;
|
|
4183
|
-
nowMs: number;
|
|
4184
|
-
/** Inbox items, as from a plugin route. */
|
|
4185
|
-
inboxItems: PluginConversationInboxItems;
|
|
4468
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4469
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4470
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4471
|
+
userId: z.ZodString;
|
|
4472
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4473
|
+
platform: z.ZodLiteral<"local">;
|
|
4474
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4475
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4476
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4477
|
+
userId: z.ZodString;
|
|
4478
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4479
|
+
platform: z.ZodLiteral<"web">;
|
|
4480
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4481
|
+
platform: z.ZodLiteral<"system">;
|
|
4482
|
+
name: z.ZodString;
|
|
4483
|
+
}, z.core.$strict>], "platform">>;
|
|
4484
|
+
}, z.core.$strict>>;
|
|
4485
|
+
isRunActor: z.ZodOptional<z.ZodBoolean>;
|
|
4486
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4487
|
+
type: z.ZodLiteral<"toolResult">;
|
|
4488
|
+
toolName: z.ZodString;
|
|
4489
|
+
isError: z.ZodBoolean;
|
|
4490
|
+
text: z.ZodOptional<z.ZodString>;
|
|
4491
|
+
}, z.core.$strict>], "type">>;
|
|
4492
|
+
}, z.core.$strict>;
|
|
4493
|
+
export type PluginRunTranscriptEntry = z.output<typeof pluginRunTranscriptEntrySchema>;
|
|
4494
|
+
export type PluginRunContext = z.output<typeof pluginRunContextSchema>;
|
|
4495
|
+
/** Runtime context passed to a plugin-owned background task. */
|
|
4496
|
+
export interface PluginTaskContext extends PluginContext {
|
|
4497
|
+
embedder: PluginEmbedder;
|
|
4498
|
+
events: PluginConversationEvents;
|
|
4499
|
+
id: string;
|
|
4500
|
+
model: PluginModel;
|
|
4501
|
+
name: string;
|
|
4502
|
+
run: {
|
|
4503
|
+
load(): Promise<PluginRunContext>;
|
|
4504
|
+
};
|
|
4186
4505
|
state: PluginState;
|
|
4187
|
-
/**
|
|
4188
|
-
|
|
4506
|
+
/** Events that this plugin emitted in the completed Turn, oldest first. */
|
|
4507
|
+
turnEvents: PluginTurnEventReader;
|
|
4189
4508
|
}
|
|
4190
|
-
/**
|
|
4191
|
-
export interface
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
* event type on this plugin resource. Watches of other Conversations and
|
|
4195
|
-
* event automations do not count.
|
|
4196
|
-
*/
|
|
4197
|
-
watching(input: {
|
|
4198
|
-
eventType: string;
|
|
4199
|
-
identifier: string;
|
|
4200
|
-
}): Promise<boolean>;
|
|
4509
|
+
/** Task that Junior runs after each completed session. */
|
|
4510
|
+
export interface PluginSessionTaskDefinition {
|
|
4511
|
+
payload?: undefined;
|
|
4512
|
+
run(ctx: PluginTaskContext): Promise<void> | void;
|
|
4201
4513
|
}
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
dispatch(options: DispatchOptions): Promise<DispatchResult>;
|
|
4205
|
-
get(id: string): Promise<Dispatch | undefined>;
|
|
4206
|
-
/**
|
|
4207
|
-
* Start a public Conversation for one person. Each call counts toward the
|
|
4208
|
-
* dispatch limit of this heartbeat. See the route context version.
|
|
4209
|
-
*/
|
|
4210
|
-
dispatchForIdentity(options: IdentityDispatchOptions): Promise<IdentityDispatchResult>;
|
|
4211
|
-
};
|
|
4212
|
-
/** Conversation annotations, as from a plugin route. */
|
|
4514
|
+
/** Runtime context passed to one attempt of a task that `tasks.start` started. */
|
|
4515
|
+
export interface PluginStartedTaskContext<Payload = unknown> extends PluginContext {
|
|
4213
4516
|
annotations: PluginConversationAnnotations;
|
|
4214
|
-
|
|
4215
|
-
codeChanges: CodeChangePublisher;
|
|
4216
|
-
/** Annotation and Inbox item changes in one write, as from a plugin route. */
|
|
4517
|
+
codeChanges: PluginCodeChanges;
|
|
4217
4518
|
conversationChanges: PluginConversationChanges;
|
|
4218
|
-
/**
|
|
4219
|
-
embedder: PluginEmbedder;
|
|
4220
|
-
/** Publish events, as from a plugin route. */
|
|
4519
|
+
/** Publishes the plugin's Events, as the heartbeat and routes do. */
|
|
4221
4520
|
events: EventPublisher;
|
|
4222
|
-
nowMs: number;
|
|
4223
4521
|
/** Inbox items, as from a plugin route. */
|
|
4224
4522
|
inboxItems: PluginConversationInboxItems;
|
|
4225
|
-
state: PluginState;
|
|
4226
|
-
}
|
|
4227
|
-
export interface HeartbeatResult {
|
|
4228
|
-
dispatchCount?: number;
|
|
4229
|
-
}
|
|
4230
|
-
export interface UnfinishedWorkHookContext extends PluginContext {
|
|
4231
|
-
/**
|
|
4232
|
-
* Bounded conversation candidates selected by the host, with the child
|
|
4233
|
-
* conversations of candidate roots. Work in a child counts for its root.
|
|
4234
|
-
*/
|
|
4235
|
-
conversationIds: string[];
|
|
4236
|
-
}
|
|
4237
|
-
export interface UnfinishedWorkResult {
|
|
4238
|
-
/** Candidate conversations that have plugin-owned work to finish. */
|
|
4239
|
-
conversationIds: string[];
|
|
4240
4523
|
/**
|
|
4241
|
-
*
|
|
4242
|
-
*
|
|
4243
|
-
*
|
|
4244
|
-
* The host uses this with unfinished work and finish times to set feed
|
|
4245
|
-
* `isPriority`. Finished assigned work stays out of Priority unless the
|
|
4246
|
-
* conversation has activity after the finish time.
|
|
4524
|
+
* True on the last delivery that Junior makes. An attempt that throws
|
|
4525
|
+
* now is not run again, so a task that waits for a provider can write
|
|
4526
|
+
* its fallback instead.
|
|
4247
4527
|
*/
|
|
4248
|
-
|
|
4528
|
+
lastDelivery: boolean;
|
|
4529
|
+
name: string;
|
|
4530
|
+
/** The payload from `tasks.start`, parsed with the task's `payload` schema. */
|
|
4531
|
+
payload: Payload;
|
|
4532
|
+
state: PluginState;
|
|
4249
4533
|
/**
|
|
4250
|
-
*
|
|
4251
|
-
*
|
|
4252
|
-
* finished work still belongs in Priority, and whether auto-archive may
|
|
4253
|
-
* archive the conversation for users who turned it on.
|
|
4534
|
+
* Starts this plugin's tasks, as from a plugin route. A task that must
|
|
4535
|
+
* wait longer than its retries cover can start itself again.
|
|
4254
4536
|
*/
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
export interface PluginOperationalMetric {
|
|
4259
|
-
label: string;
|
|
4260
|
-
tone?: PluginOperationalTone;
|
|
4261
|
-
value: string;
|
|
4262
|
-
}
|
|
4263
|
-
export interface PluginOperationalField {
|
|
4264
|
-
key: string;
|
|
4265
|
-
label: string;
|
|
4266
|
-
}
|
|
4267
|
-
export interface PluginOperationalRecord {
|
|
4268
|
-
id: string;
|
|
4269
|
-
tone?: PluginOperationalTone;
|
|
4270
|
-
values: Record<string, string>;
|
|
4271
|
-
}
|
|
4272
|
-
export interface PluginOperationalRecordSet {
|
|
4273
|
-
fields?: PluginOperationalField[];
|
|
4274
|
-
emptyText?: string;
|
|
4275
|
-
records?: PluginOperationalRecord[];
|
|
4276
|
-
title: string;
|
|
4277
|
-
}
|
|
4278
|
-
export interface PluginOperationalChartSeries {
|
|
4279
|
-
format?: "usd";
|
|
4280
|
-
key: string;
|
|
4281
|
-
label: string;
|
|
4282
|
-
tone?: PluginOperationalTone;
|
|
4283
|
-
}
|
|
4284
|
-
export interface PluginOperationalChartCategory {
|
|
4285
|
-
id: string;
|
|
4286
|
-
label: string;
|
|
4287
|
-
values: Record<string, number>;
|
|
4288
|
-
}
|
|
4289
|
-
export interface PluginOperationalBarChartWidget {
|
|
4290
|
-
categories: PluginOperationalChartCategory[];
|
|
4291
|
-
description?: string;
|
|
4292
|
-
emptyText?: string;
|
|
4293
|
-
id: string;
|
|
4294
|
-
series: PluginOperationalChartSeries[];
|
|
4295
|
-
timeRangeDays?: Array<1 | 7 | 30 | 90>;
|
|
4296
|
-
title: string;
|
|
4297
|
-
type: "bar_chart";
|
|
4298
|
-
}
|
|
4299
|
-
export interface PluginOperationalReportContent {
|
|
4300
|
-
generatedAt?: string;
|
|
4301
|
-
metrics?: PluginOperationalMetric[];
|
|
4302
|
-
recordSets?: PluginOperationalRecordSet[];
|
|
4303
|
-
title?: string;
|
|
4304
|
-
widgets?: PluginOperationalBarChartWidget[];
|
|
4305
|
-
}
|
|
4306
|
-
export interface PluginOperationalReport extends PluginOperationalReportContent {
|
|
4307
|
-
pluginName: string;
|
|
4308
|
-
}
|
|
4309
|
-
export interface OperationalReportHookContext extends PluginContext {
|
|
4310
|
-
eventStats: PluginConversationEventStats;
|
|
4311
|
-
nowMs: number;
|
|
4312
|
-
state: PluginReadState;
|
|
4313
|
-
}
|
|
4314
|
-
/** Read-only context for one person-scoped plugin report on a profile page. */
|
|
4315
|
-
export interface ProfileReportHookContext extends PluginContext {
|
|
4316
|
-
nowMs: number;
|
|
4317
|
-
state: PluginReadState;
|
|
4318
|
-
/** Canonical user for the profile being viewed. */
|
|
4319
|
-
subject: User;
|
|
4320
|
-
/** Canonical user for the authenticated viewer. */
|
|
4321
|
-
viewer: User;
|
|
4322
|
-
}
|
|
4323
|
-
export type PluginRouteMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "ALL";
|
|
4324
|
-
export type PluginRouteHandler = {
|
|
4325
|
-
bivarianceHack(request: Request): Promise<Response> | Response;
|
|
4326
|
-
}["bivarianceHack"];
|
|
4327
|
-
export interface PluginRoute {
|
|
4328
|
-
handler: PluginRouteHandler;
|
|
4329
|
-
method?: PluginRouteMethod | PluginRouteMethod[];
|
|
4330
|
-
path: string;
|
|
4331
|
-
}
|
|
4332
|
-
/** Fetch-compatible plugin HTTP app mounted by Junior. */
|
|
4333
|
-
export type PluginRouteApp = {
|
|
4334
|
-
fetch(request: Request, context?: PluginApiRouteRequestContext): Promise<Response> | Response;
|
|
4335
|
-
};
|
|
4336
|
-
export interface RouteRegistrationHookContext extends PluginContext {
|
|
4337
|
-
agent: {
|
|
4338
|
-
/**
|
|
4339
|
-
* Start a public Conversation for one person, as if they sent `input` from
|
|
4340
|
-
* the dashboard. It has no Slack Destination. Core starts work only when
|
|
4341
|
-
* the person maps to exactly one current Slack member on the allowed
|
|
4342
|
-
* domains: through an Identity of this plugin's provider that the OAuth
|
|
4343
|
-
* account-linking flow linked, or through a verified email that is the
|
|
4344
|
-
* User's primary email and the member's Slack email. Otherwise it returns
|
|
4345
|
-
* `not_linked` and calls no model.
|
|
4346
|
-
*/
|
|
4347
|
-
dispatchForIdentity(options: IdentityDispatchOptions): Promise<IdentityDispatchResult>;
|
|
4348
|
-
};
|
|
4349
|
-
annotations: PluginConversationAnnotations;
|
|
4350
|
-
/** Provider-neutral write boundary for Junior's native code index. */
|
|
4351
|
-
codeChanges: CodeChangePublisher;
|
|
4352
|
-
/** Annotation and Inbox item changes that readers must see together. */
|
|
4353
|
-
conversationChanges: PluginConversationChanges;
|
|
4354
|
-
/** Core-owned delivery boundary for provider webhook events. */
|
|
4355
|
-
events: EventPublisher;
|
|
4356
|
-
/** Inbox items that the plugin adds and closes from its events. */
|
|
4357
|
-
inboxItems: PluginConversationInboxItems;
|
|
4358
|
-
/** Plugin-namespaced state, the same as in heartbeats. */
|
|
4359
|
-
state: PluginState;
|
|
4360
|
-
users: {
|
|
4361
|
-
/**
|
|
4362
|
-
* Read one stored identity and the user it links to now, with every
|
|
4363
|
-
* identity of that user. A plugin that saved an identity id uses this to
|
|
4364
|
-
* find the person's other linked accounts later.
|
|
4365
|
-
*/
|
|
4366
|
-
readIdentity(identityId: string): Promise<{
|
|
4367
|
-
identity: Identity;
|
|
4368
|
-
user?: User;
|
|
4369
|
-
} | undefined>;
|
|
4370
|
-
};
|
|
4537
|
+
tasks: PluginTaskStarter;
|
|
4538
|
+
/** Stored identities and their users, as from a plugin route. */
|
|
4539
|
+
users: RouteRegistrationHookContext["users"];
|
|
4371
4540
|
}
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4541
|
+
/**
|
|
4542
|
+
* Task that runs only when the plugin starts it with `tasks.start`. Junior
|
|
4543
|
+
* sends the payload as JSON in the queue message and parses it with
|
|
4544
|
+
* `payload` before each attempt. A failed attempt runs again later, a
|
|
4545
|
+
* bounded number of times.
|
|
4546
|
+
*/
|
|
4547
|
+
export interface PluginStartedTaskDefinition<Schema extends z.ZodType = z.ZodType> {
|
|
4548
|
+
payload: Schema;
|
|
4549
|
+
run(ctx: PluginStartedTaskContext<z.output<Schema>>): Promise<void> | void;
|
|
4379
4550
|
}
|
|
4380
|
-
/**
|
|
4381
|
-
export
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
pluginName: z.ZodString;
|
|
4551
|
+
/** Plugin task handler registered by name in a plugin manifest module. */
|
|
4552
|
+
export type PluginTaskDefinition = PluginSessionTaskDefinition | PluginStartedTaskDefinition;
|
|
4553
|
+
/** Task handlers keyed by the plugin-owned task name. */
|
|
4554
|
+
export type PluginTasks = Record<string, PluginTaskDefinition>;
|
|
4555
|
+
/** Input of `tasks.start`. */
|
|
4556
|
+
export declare const pluginTaskStartInputSchema: z.ZodObject<{
|
|
4557
|
+
key: z.ZodString;
|
|
4558
|
+
name: z.ZodString;
|
|
4559
|
+
delaySeconds: z.ZodOptional<z.ZodNumber>;
|
|
4560
|
+
payload: z.ZodUnknown;
|
|
4391
4561
|
}, z.core.$strict>;
|
|
4392
|
-
export type
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
export interface SlackConversationLinkHookContext extends PluginContext {
|
|
4397
|
-
conversationId: string;
|
|
4562
|
+
export type PluginTaskStartInput = z.output<typeof pluginTaskStartInputSchema>;
|
|
4563
|
+
/** Starts this plugin's tasks on the plugin task queue. */
|
|
4564
|
+
export interface PluginTaskStarter {
|
|
4565
|
+
start(input: PluginTaskStartInput): Promise<void>;
|
|
4398
4566
|
}
|
|
4399
4567
|
/**
|
|
4400
4568
|
* Deny provider egress when a plugin policy does not allow the request.
|
|
@@ -4475,11 +4643,14 @@ export interface PluginHooks {
|
|
|
4475
4643
|
conversationTitleContext?(ctx: ConversationTitleContextHookContext): Promise<string[] | undefined> | string[] | undefined;
|
|
4476
4644
|
conversationSidebar?(ctx: ConversationSidebarHookContext): Promise<ConversationSidebarResult> | ConversationSidebarResult;
|
|
4477
4645
|
/**
|
|
4478
|
-
* Return static guidance for the system
|
|
4479
|
-
*
|
|
4480
|
-
* that
|
|
4646
|
+
* Return static guidance for the system prompts of one platform. Junior
|
|
4647
|
+
* runs this hook once at build for each platform, uses its output in the
|
|
4648
|
+
* system prompt of every Prompt mode on that platform, and freezes it for
|
|
4649
|
+
* the deployment. So every Turn gets the same system prompt, and the model
|
|
4650
|
+
* provider can cache it. The hook may do I/O, but that I/O happens only at
|
|
4651
|
+
* build. Put text that changes per request in `userPrompt`.
|
|
4481
4652
|
*/
|
|
4482
|
-
systemPrompt?(ctx:
|
|
4653
|
+
systemPrompt?(ctx: SystemPromptBuildContext): Promise<PromptMessage[]> | PromptMessage[];
|
|
4483
4654
|
/**
|
|
4484
4655
|
* Return per-request context for a new prompt, such as recalled memories.
|
|
4485
4656
|
* Junior runs this hook at the same time as Turn routing and sandbox setup,
|
|
@@ -4612,7 +4783,57 @@ export interface PluginOAuthBearerCredentials {
|
|
|
4612
4783
|
domains: string[];
|
|
4613
4784
|
type: "oauth-bearer";
|
|
4614
4785
|
}
|
|
4615
|
-
|
|
4786
|
+
/** Request header that carries a workload identity token. */
|
|
4787
|
+
export type PluginWorkloadIdentityHeader = "Authorization" | "Proxy-Authorization" | "X-Serverless-Authorization";
|
|
4788
|
+
/**
|
|
4789
|
+
* Google Cloud token that Junior mints for one service account.
|
|
4790
|
+
*
|
|
4791
|
+
* `service-account-jwt` signs a JWT with `iss` and `sub` set to the service
|
|
4792
|
+
* account (Identity-Aware Proxy accepts it). `id-token` mints a Google ID
|
|
4793
|
+
* token (Cloud Run accepts it). `access-token` mints an OAuth access token for
|
|
4794
|
+
* Google APIs.
|
|
4795
|
+
*/
|
|
4796
|
+
export type PluginGcpWorkloadIdentityToken = {
|
|
4797
|
+
audience: string;
|
|
4798
|
+
token: "id-token";
|
|
4799
|
+
} | {
|
|
4800
|
+
audience: string;
|
|
4801
|
+
token: "service-account-jwt";
|
|
4802
|
+
} | {
|
|
4803
|
+
scopes: string[];
|
|
4804
|
+
token: "access-token";
|
|
4805
|
+
};
|
|
4806
|
+
/** Google Cloud workload identity federation through one service account. */
|
|
4807
|
+
export type PluginGcpWorkloadIdentityConfig = PluginGcpWorkloadIdentityToken & {
|
|
4808
|
+
/** Service account email that Junior impersonates. */
|
|
4809
|
+
serviceAccount: string;
|
|
4810
|
+
/** `projects/<number>/locations/global/workloadIdentityPools/<pool>/providers/<provider>`. */
|
|
4811
|
+
workloadIdentityProvider: string;
|
|
4812
|
+
};
|
|
4813
|
+
/** Microsoft Entra ID workload identity federation for one app registration. */
|
|
4814
|
+
export interface PluginAzureWorkloadIdentityConfig {
|
|
4815
|
+
clientId: string;
|
|
4816
|
+
/** Token scope, such as `api://<app>/.default`. */
|
|
4817
|
+
scope: string;
|
|
4818
|
+
tenantId: string;
|
|
4819
|
+
}
|
|
4820
|
+
/**
|
|
4821
|
+
* Bot credential that Junior mints on the host from the deployment's Vercel
|
|
4822
|
+
* OIDC token. Set exactly one of `gcp` or `azure`.
|
|
4823
|
+
*/
|
|
4824
|
+
export type PluginWorkloadIdentityCredentials = {
|
|
4825
|
+
domains: string[];
|
|
4826
|
+
/** Defaults to `Authorization`. */
|
|
4827
|
+
header?: PluginWorkloadIdentityHeader;
|
|
4828
|
+
type: "workload-identity";
|
|
4829
|
+
} & ({
|
|
4830
|
+
azure?: never;
|
|
4831
|
+
gcp: PluginGcpWorkloadIdentityConfig;
|
|
4832
|
+
} | {
|
|
4833
|
+
azure: PluginAzureWorkloadIdentityConfig;
|
|
4834
|
+
gcp?: never;
|
|
4835
|
+
});
|
|
4836
|
+
export type PluginCredentials = PluginOAuthBearerCredentials | PluginWorkloadIdentityCredentials;
|
|
4616
4837
|
export interface PluginNpmRuntimeDependency {
|
|
4617
4838
|
package: string;
|
|
4618
4839
|
type: "npm";
|
|
@@ -4898,4 +5119,4 @@ export declare function markdownText(node: MarkdownNode, options?: MarkdownTextO
|
|
|
4898
5119
|
* each run of whitespace made one space.
|
|
4899
5120
|
*/
|
|
4900
5121
|
export declare function markdownPlainText(text: string, options?: MarkdownTextOptions): string;
|
|
4901
|
-
export type { PromptContext, PromptContextContribution, PromptHistory, PromptHistoryContext, PromptMessage,
|
|
5122
|
+
export type { PromptContext, PromptContextContribution, PromptHistory, PromptHistoryContext, PromptMessage, SystemPromptBuildContext, UserPromptContext, UserPromptContribution };
|