@yaklabs-ai/plugin-sdk 0.37.1 → 0.39.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/README.md +2 -2
- package/THIRD-PARTY-INVENTORY.json +1 -1
- package/dist/disclosure.d.ts +10 -1
- package/dist/kay-agent-testing.d.ts +46 -5
- package/dist/kay-agent.d.ts +14 -1
- package/dist/kay-app-session-summary.d.ts +1 -1
- package/dist/kay-app.d.ts +144 -4
- package/dist/kay-app.js +105 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ it under the name your plugin code actually imports:
|
|
|
13
13
|
```json
|
|
14
14
|
{
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@bonsai/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.
|
|
16
|
+
"@bonsai/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.39.0"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
```
|
|
@@ -62,7 +62,7 @@ Every tool the entrypoint registers is declared in the manifest too:
|
|
|
62
62
|
"description": "Greets people by name.",
|
|
63
63
|
"version": "0.1.0",
|
|
64
64
|
"namespace": "widgets",
|
|
65
|
-
"compatibility": { "sdk": "^0.
|
|
65
|
+
"compatibility": { "sdk": "^0.39.0" },
|
|
66
66
|
"targets": {
|
|
67
67
|
"kay": {
|
|
68
68
|
"agent": {
|
package/dist/disclosure.d.ts
CHANGED
|
@@ -2399,8 +2399,17 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
|
|
|
2399
2399
|
* 0.37.1 adds the required, ungated `featureFlags.value(key)` reader to both backend targets.
|
|
2400
2400
|
* Unknown keys return false; the host supplies evaluated values before activation and updates them.
|
|
2401
2401
|
* Additive: existing plugins keep loading. A consumer declares ^0.37.1.
|
|
2402
|
+
*
|
|
2403
|
+
* 0.38.0 adds signals (epic #15668). An event definition may declare `signal: true`, and its payload
|
|
2404
|
+
* is then the shared `PluginSignal` v1 with a `related.thread`; a workflow of a plugin the release
|
|
2405
|
+
* carries may start on every plugin's signals with `{ kind: "plugin-event", signals: true }` (the
|
|
2406
|
+
* private `workflows.signals` claim). Additive: a plugin that declares a signal declares ^0.38.0.
|
|
2407
|
+
*
|
|
2408
|
+
* 0.39.0 lets a plugin word its own addresses (#15750). A reference presentation gains `words`, and
|
|
2409
|
+
* `open` and `resourceKind` become an optional pair, so a module can name its rows, tallies and live
|
|
2410
|
+
* phrases without its addresses opening. Additive. A plugin that declares words declares ^0.39.0.
|
|
2402
2411
|
*/
|
|
2403
|
-
declare const KAY_PLUGIN_SDK_VERSION: "0.
|
|
2412
|
+
declare const KAY_PLUGIN_SDK_VERSION: "0.39.0";
|
|
2404
2413
|
|
|
2405
2414
|
declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
|
|
2406
2415
|
|
|
@@ -2453,8 +2453,17 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
|
|
|
2453
2453
|
* 0.37.1 adds the required, ungated `featureFlags.value(key)` reader to both backend targets.
|
|
2454
2454
|
* Unknown keys return false; the host supplies evaluated values before activation and updates them.
|
|
2455
2455
|
* Additive: existing plugins keep loading. A consumer declares ^0.37.1.
|
|
2456
|
+
*
|
|
2457
|
+
* 0.38.0 adds signals (epic #15668). An event definition may declare `signal: true`, and its payload
|
|
2458
|
+
* is then the shared `PluginSignal` v1 with a `related.thread`; a workflow of a plugin the release
|
|
2459
|
+
* carries may start on every plugin's signals with `{ kind: "plugin-event", signals: true }` (the
|
|
2460
|
+
* private `workflows.signals` claim). Additive: a plugin that declares a signal declares ^0.38.0.
|
|
2461
|
+
*
|
|
2462
|
+
* 0.39.0 lets a plugin word its own addresses (#15750). A reference presentation gains `words`, and
|
|
2463
|
+
* `open` and `resourceKind` become an optional pair, so a module can name its rows, tallies and live
|
|
2464
|
+
* phrases without its addresses opening. Additive. A plugin that declares words declares ^0.39.0.
|
|
2456
2465
|
*/
|
|
2457
|
-
declare const KAY_PLUGIN_SDK_VERSION: "0.
|
|
2466
|
+
declare const KAY_PLUGIN_SDK_VERSION: "0.39.0";
|
|
2458
2467
|
|
|
2459
2468
|
declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
|
|
2460
2469
|
|
|
@@ -5652,9 +5661,9 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
|
|
|
5652
5661
|
pluginId: z.ZodString;
|
|
5653
5662
|
url: z.ZodString;
|
|
5654
5663
|
auth: z.ZodEnum<{
|
|
5664
|
+
none: "none";
|
|
5655
5665
|
oauth: "oauth";
|
|
5656
5666
|
"api-key": "api-key";
|
|
5657
|
-
none: "none";
|
|
5658
5667
|
}>;
|
|
5659
5668
|
authServiceId: z.ZodOptional<z.ZodString>;
|
|
5660
5669
|
}, z.core.$strict>>>;
|
|
@@ -5670,6 +5679,7 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
|
|
|
5670
5679
|
globalId: z.ZodString;
|
|
5671
5680
|
uriModule: z.ZodOptional<z.ZodString>;
|
|
5672
5681
|
schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
5682
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
5673
5683
|
addresses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
5674
5684
|
pattern: z.ZodObject<{
|
|
5675
5685
|
protocol: z.ZodString;
|
|
@@ -5682,15 +5692,15 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
|
|
|
5682
5692
|
kind: z.ZodLiteral<"none">;
|
|
5683
5693
|
}, z.core.$strict>>;
|
|
5684
5694
|
}, z.core.$strict>>>;
|
|
5685
|
-
resourceKind: z.ZodString
|
|
5686
|
-
open: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5695
|
+
resourceKind: z.ZodOptional<z.ZodString>;
|
|
5696
|
+
open: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5687
5697
|
kind: z.ZodLiteral<"working-document">;
|
|
5688
5698
|
}, z.core.$strict>, z.ZodObject<{
|
|
5689
5699
|
kind: z.ZodLiteral<"browser-pane">;
|
|
5690
5700
|
}, z.core.$strict>, z.ZodObject<{
|
|
5691
5701
|
kind: z.ZodLiteral<"page">;
|
|
5692
5702
|
pageId: z.ZodString;
|
|
5693
|
-
}, z.core.$strict>], "kind"
|
|
5703
|
+
}, z.core.$strict>], "kind">>;
|
|
5694
5704
|
variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
5695
5705
|
resourceKind: z.ZodString;
|
|
5696
5706
|
presentationPluginId: z.ZodOptional<z.ZodString>;
|
|
@@ -5717,6 +5727,37 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
|
|
|
5717
5727
|
search: z.ZodOptional<z.ZodString>;
|
|
5718
5728
|
}, z.core.$strict>;
|
|
5719
5729
|
}, z.core.$strict>>;
|
|
5730
|
+
words: z.ZodOptional<z.ZodObject<{
|
|
5731
|
+
glyph: z.ZodOptional<z.ZodEnum<{
|
|
5732
|
+
file: "file";
|
|
5733
|
+
terminal: "terminal";
|
|
5734
|
+
note: "note";
|
|
5735
|
+
search: "search";
|
|
5736
|
+
person: "person";
|
|
5737
|
+
session: "session";
|
|
5738
|
+
browser: "browser";
|
|
5739
|
+
folder: "folder";
|
|
5740
|
+
repo: "repo";
|
|
5741
|
+
clock: "clock";
|
|
5742
|
+
robot: "robot";
|
|
5743
|
+
globe: "globe";
|
|
5744
|
+
skill: "skill";
|
|
5745
|
+
memory: "memory";
|
|
5746
|
+
plan: "plan";
|
|
5747
|
+
download: "download";
|
|
5748
|
+
attachment: "attachment";
|
|
5749
|
+
settings: "settings";
|
|
5750
|
+
catalog: "catalog";
|
|
5751
|
+
model: "model";
|
|
5752
|
+
doc: "doc";
|
|
5753
|
+
feedback: "feedback";
|
|
5754
|
+
plugin: "plugin";
|
|
5755
|
+
}>>;
|
|
5756
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
5757
|
+
noun: z.ZodOptional<z.ZodString>;
|
|
5758
|
+
target: z.ZodOptional<z.ZodString>;
|
|
5759
|
+
kindNamesSource: z.ZodOptional<z.ZodLiteral<true>>;
|
|
5760
|
+
}, z.core.$strict>>;
|
|
5720
5761
|
}, z.core.$strict>>>;
|
|
5721
5762
|
kayUiApps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
5722
5763
|
localId: z.ZodString;
|
package/dist/kay-agent.d.ts
CHANGED
|
@@ -2728,8 +2728,17 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
|
|
|
2728
2728
|
* 0.37.1 adds the required, ungated `featureFlags.value(key)` reader to both backend targets.
|
|
2729
2729
|
* Unknown keys return false; the host supplies evaluated values before activation and updates them.
|
|
2730
2730
|
* Additive: existing plugins keep loading. A consumer declares ^0.37.1.
|
|
2731
|
+
*
|
|
2732
|
+
* 0.38.0 adds signals (epic #15668). An event definition may declare `signal: true`, and its payload
|
|
2733
|
+
* is then the shared `PluginSignal` v1 with a `related.thread`; a workflow of a plugin the release
|
|
2734
|
+
* carries may start on every plugin's signals with `{ kind: "plugin-event", signals: true }` (the
|
|
2735
|
+
* private `workflows.signals` claim). Additive: a plugin that declares a signal declares ^0.38.0.
|
|
2736
|
+
*
|
|
2737
|
+
* 0.39.0 lets a plugin word its own addresses (#15750). A reference presentation gains `words`, and
|
|
2738
|
+
* `open` and `resourceKind` become an optional pair, so a module can name its rows, tallies and live
|
|
2739
|
+
* phrases without its addresses opening. Additive. A plugin that declares words declares ^0.39.0.
|
|
2731
2740
|
*/
|
|
2732
|
-
declare const KAY_PLUGIN_SDK_VERSION: "0.
|
|
2741
|
+
declare const KAY_PLUGIN_SDK_VERSION: "0.39.0";
|
|
2733
2742
|
|
|
2734
2743
|
declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
|
|
2735
2744
|
|
|
@@ -5087,6 +5096,10 @@ declare const PluginCapabilityRefusalV1: z.ZodObject<{
|
|
|
5087
5096
|
target: z.ZodLiteral<"kay.app">;
|
|
5088
5097
|
slug: z.ZodLiteral<"workflows.define">;
|
|
5089
5098
|
envelope: z.ZodObject<{}, z.core.$strict>;
|
|
5099
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
5100
|
+
target: z.ZodLiteral<"kay.app">;
|
|
5101
|
+
slug: z.ZodLiteral<"workflows.signals">;
|
|
5102
|
+
envelope: z.ZodObject<{}, z.core.$strict>;
|
|
5090
5103
|
}, z.core.$strict>, z.ZodObject<{
|
|
5091
5104
|
target: z.ZodLiteral<"kay.app">;
|
|
5092
5105
|
slug: z.ZodLiteral<"session-events.subscribe">;
|
|
@@ -453,8 +453,8 @@ declare const CorpusResourceInvocationQuery: z.ZodObject<{
|
|
|
453
453
|
}, z.core.$strict>>;
|
|
454
454
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
455
455
|
rootCreatedByKind: z.ZodOptional<z.ZodEnum<{
|
|
456
|
-
agent: "agent";
|
|
457
456
|
plugin: "plugin";
|
|
457
|
+
agent: "agent";
|
|
458
458
|
human: "human";
|
|
459
459
|
trigger: "trigger";
|
|
460
460
|
daemon: "daemon";
|
package/dist/kay-app.d.ts
CHANGED
|
@@ -795,8 +795,8 @@ export declare const CorpusResourceInvocationQuery: z.ZodObject<{
|
|
|
795
795
|
}, z.core.$strict>>;
|
|
796
796
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
797
797
|
rootCreatedByKind: z.ZodOptional<z.ZodEnum<{
|
|
798
|
-
agent: "agent";
|
|
799
798
|
plugin: "plugin";
|
|
799
|
+
agent: "agent";
|
|
800
800
|
human: "human";
|
|
801
801
|
trigger: "trigger";
|
|
802
802
|
daemon: "daemon";
|
|
@@ -1813,6 +1813,20 @@ declare function IsCodec(value: unknown): value is TCodec;
|
|
|
1813
1813
|
/** Returns true if the given value is a TConstructor. */
|
|
1814
1814
|
declare function IsConstructor(value: unknown): value is TConstructor;
|
|
1815
1815
|
|
|
1816
|
+
/**
|
|
1817
|
+
* The recognized credential VALUE formats: one detector for the runtime wire's raw-credential
|
|
1818
|
+
* tripwire (`@bonsai/agent-runtime-protocol`'s `hasRawCredentialField`) and for a plugin that
|
|
1819
|
+
* must keep such text out of what it publishes, so the two cannot disagree on what a hit is.
|
|
1820
|
+
* Lives here, below both, because a plugin cannot import the runtime protocol.
|
|
1821
|
+
*/
|
|
1822
|
+
/**
|
|
1823
|
+
* Whether `value` is a string in a recognized credential format (a whole `sk-...`, `ghp_...` or
|
|
1824
|
+
* `xoxb-...` token, a JWT, an Authorization header value, or anything holding a PEM private key
|
|
1825
|
+
* block). A publisher that copies outside text into an event drops or replaces such a string:
|
|
1826
|
+
* the daemon refuses an event that carries one.
|
|
1827
|
+
*/
|
|
1828
|
+
export declare function isCredentialShapedText(value: unknown): boolean;
|
|
1829
|
+
|
|
1816
1830
|
/** Returns true if the given value is a TCyclic. */
|
|
1817
1831
|
declare function IsCyclic(value: unknown): value is TCyclic;
|
|
1818
1832
|
|
|
@@ -2690,8 +2704,17 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
|
|
|
2690
2704
|
* 0.37.1 adds the required, ungated `featureFlags.value(key)` reader to both backend targets.
|
|
2691
2705
|
* Unknown keys return false; the host supplies evaluated values before activation and updates them.
|
|
2692
2706
|
* Additive: existing plugins keep loading. A consumer declares ^0.37.1.
|
|
2707
|
+
*
|
|
2708
|
+
* 0.38.0 adds signals (epic #15668). An event definition may declare `signal: true`, and its payload
|
|
2709
|
+
* is then the shared `PluginSignal` v1 with a `related.thread`; a workflow of a plugin the release
|
|
2710
|
+
* carries may start on every plugin's signals with `{ kind: "plugin-event", signals: true }` (the
|
|
2711
|
+
* private `workflows.signals` claim). Additive: a plugin that declares a signal declares ^0.38.0.
|
|
2712
|
+
*
|
|
2713
|
+
* 0.39.0 lets a plugin word its own addresses (#15750). A reference presentation gains `words`, and
|
|
2714
|
+
* `open` and `resourceKind` become an optional pair, so a module can name its rows, tallies and live
|
|
2715
|
+
* phrases without its addresses opening. Additive. A plugin that declares words declares ^0.39.0.
|
|
2693
2716
|
*/
|
|
2694
|
-
declare const KAY_PLUGIN_SDK_VERSION: "0.
|
|
2717
|
+
declare const KAY_PLUGIN_SDK_VERSION: "0.39.0";
|
|
2695
2718
|
|
|
2696
2719
|
declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
|
|
2697
2720
|
|
|
@@ -8317,6 +8340,22 @@ export declare interface KayAppWorkflows {
|
|
|
8317
8340
|
inspect(localId: string, options?: KayAppWorkflowInspectOptions): Promise<KayAppWorkflowInspection>;
|
|
8318
8341
|
}
|
|
8319
8342
|
|
|
8343
|
+
/**
|
|
8344
|
+
* Every event any plugin declares `signal: true`, from every plugin, including plugins installed
|
|
8345
|
+
* later. The payload of each is `PluginSignal` v1, and `related.thread` names its conversation or
|
|
8346
|
+
* object, so the workflow handles a new source without changing.
|
|
8347
|
+
*
|
|
8348
|
+
* Only a plugin Bonsai ships may define one: it asks for the private `workflows.signals` claim,
|
|
8349
|
+
* and any other plugin's activation is refused. `where` filters take envelope paths,
|
|
8350
|
+
* `related.thread|from|to|cc` and `payload.<PluginSignal field>`.
|
|
8351
|
+
*/
|
|
8352
|
+
export declare interface KayAppWorkflowSignalsTrigger {
|
|
8353
|
+
readonly kind: "plugin-event";
|
|
8354
|
+
readonly signals: true;
|
|
8355
|
+
readonly events?: undefined;
|
|
8356
|
+
readonly where?: KayAppAutomationPluginEventCondition["where"];
|
|
8357
|
+
}
|
|
8358
|
+
|
|
8320
8359
|
export declare type KayAppWorkflowTimeTrigger = Extract<KayAppAutomationConditionInput, {
|
|
8321
8360
|
readonly kind: "time";
|
|
8322
8361
|
}>;
|
|
@@ -8326,12 +8365,13 @@ export declare type KayAppWorkflowTimeTrigger = Extract<KayAppAutomationConditio
|
|
|
8326
8365
|
*
|
|
8327
8366
|
* An event trigger names full event types (`google.gmail.message.received`) and takes the same
|
|
8328
8367
|
* filters as a `plugin-event` automation. Each matching event starts one run. Only events this
|
|
8329
|
-
* plugin declares are accepted; another plugin's events are refused at `define`.
|
|
8368
|
+
* plugin declares are accepted; another plugin's events are refused at `define`. The one way to
|
|
8369
|
+
* hear other plugins is {@link KayAppWorkflowSignalsTrigger}, for plugins Bonsai ships.
|
|
8330
8370
|
*
|
|
8331
8371
|
* A run is not started by an event that one of this workflow's own runs published, as long as the
|
|
8332
8372
|
* publish names the run: pass `source: { runId: ctx.runId }` (the Poller helper does).
|
|
8333
8373
|
*/
|
|
8334
|
-
export declare type KayAppWorkflowTrigger = KayAppWorkflowTimeTrigger | KayAppAutomationPluginEventCondition;
|
|
8374
|
+
export declare type KayAppWorkflowTrigger = KayAppWorkflowTimeTrigger | KayAppAutomationPluginEventCondition | KayAppWorkflowSignalsTrigger;
|
|
8335
8375
|
|
|
8336
8376
|
/**
|
|
8337
8377
|
* Read/arrange access to the live desktop workspace (tabs, panes, the shell chrome). Always
|
|
@@ -9711,6 +9751,26 @@ declare function Pick_2<Type extends TSchema, Indexer extends TSchema>(type: Typ
|
|
|
9711
9751
|
/** Creates a deferred Pick action. */
|
|
9712
9752
|
declare function PickDeferred<Type extends TSchema, Indexer extends TSchema>(type: Type, indexer: Indexer, options?: TSchemaOptions): TPickDeferred<Type, Indexer>;
|
|
9713
9753
|
|
|
9754
|
+
/**
|
|
9755
|
+
* The `name` of the error a host throws when it refuses a publish because the event is invalid.
|
|
9756
|
+
* A publisher skips such an event; any other publish failure may be transient.
|
|
9757
|
+
*/
|
|
9758
|
+
export declare const PLUGIN_EVENT_REFUSED_ERROR_NAME = "PluginEventRefusedError";
|
|
9759
|
+
|
|
9760
|
+
/** The `kind` values of `PluginSignal` v1. `status` is system state that clears itself. */
|
|
9761
|
+
export declare const PLUGIN_SIGNAL_KINDS: readonly ["message", "request", "mention", "invite", "status"];
|
|
9762
|
+
|
|
9763
|
+
export declare const PLUGIN_SIGNAL_LABEL_MAX = 64;
|
|
9764
|
+
|
|
9765
|
+
export declare const PLUGIN_SIGNAL_LABELS_MAX = 20;
|
|
9766
|
+
|
|
9767
|
+
/** The `related` keys a signal may use; `thread` is required on every signal publish. */
|
|
9768
|
+
export declare const PLUGIN_SIGNAL_RELATED_KEYS: readonly ["thread", "from", "to", "cc"];
|
|
9769
|
+
|
|
9770
|
+
export declare const PLUGIN_SIGNAL_SNIPPET_MAX = 500;
|
|
9771
|
+
|
|
9772
|
+
export declare const PLUGIN_SIGNAL_TITLE_MAX = 300;
|
|
9773
|
+
|
|
9714
9774
|
export declare const PluginAgentDefinitionPermissionRule: z.ZodObject<{
|
|
9715
9775
|
effect: z.ZodEnum<{
|
|
9716
9776
|
allow: "allow";
|
|
@@ -9781,6 +9841,86 @@ declare const PluginNamespace: z.ZodString;
|
|
|
9781
9841
|
|
|
9782
9842
|
declare type PluginNamespace = z.infer<typeof PluginNamespace>;
|
|
9783
9843
|
|
|
9844
|
+
export declare const PluginSignal: z.ZodObject<{
|
|
9845
|
+
kind: z.ZodEnum<{
|
|
9846
|
+
message: "message";
|
|
9847
|
+
status: "status";
|
|
9848
|
+
request: "request";
|
|
9849
|
+
mention: "mention";
|
|
9850
|
+
invite: "invite";
|
|
9851
|
+
}>;
|
|
9852
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
9853
|
+
out: "out";
|
|
9854
|
+
in: "in";
|
|
9855
|
+
}>>;
|
|
9856
|
+
title: z.ZodOptional<z.ZodString>;
|
|
9857
|
+
snippet: z.ZodOptional<z.ZodString>;
|
|
9858
|
+
actor: z.ZodOptional<z.ZodObject<{
|
|
9859
|
+
name: z.ZodOptional<z.ZodString>;
|
|
9860
|
+
uri: z.ZodString;
|
|
9861
|
+
}, z.core.$strict>>;
|
|
9862
|
+
addressed: z.ZodOptional<z.ZodEnum<{
|
|
9863
|
+
mention: "mention";
|
|
9864
|
+
cc: "cc";
|
|
9865
|
+
direct: "direct";
|
|
9866
|
+
group: "group";
|
|
9867
|
+
none: "none";
|
|
9868
|
+
}>>;
|
|
9869
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
9870
|
+
dueAt: z.ZodOptional<z.ZodISODateTime>;
|
|
9871
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
9872
|
+
open: "open";
|
|
9873
|
+
resolved: "resolved";
|
|
9874
|
+
}>>;
|
|
9875
|
+
}, z.core.$strict>;
|
|
9876
|
+
|
|
9877
|
+
export declare type PluginSignal = z.infer<typeof PluginSignal>;
|
|
9878
|
+
|
|
9879
|
+
export declare type PluginSignalKind = (typeof PLUGIN_SIGNAL_KINDS)[number];
|
|
9880
|
+
|
|
9881
|
+
export declare const PluginSignalPublish: z.ZodObject<{
|
|
9882
|
+
payload: z.ZodObject<{
|
|
9883
|
+
kind: z.ZodEnum<{
|
|
9884
|
+
message: "message";
|
|
9885
|
+
status: "status";
|
|
9886
|
+
request: "request";
|
|
9887
|
+
mention: "mention";
|
|
9888
|
+
invite: "invite";
|
|
9889
|
+
}>;
|
|
9890
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
9891
|
+
out: "out";
|
|
9892
|
+
in: "in";
|
|
9893
|
+
}>>;
|
|
9894
|
+
title: z.ZodOptional<z.ZodString>;
|
|
9895
|
+
snippet: z.ZodOptional<z.ZodString>;
|
|
9896
|
+
actor: z.ZodOptional<z.ZodObject<{
|
|
9897
|
+
name: z.ZodOptional<z.ZodString>;
|
|
9898
|
+
uri: z.ZodString;
|
|
9899
|
+
}, z.core.$strict>>;
|
|
9900
|
+
addressed: z.ZodOptional<z.ZodEnum<{
|
|
9901
|
+
mention: "mention";
|
|
9902
|
+
cc: "cc";
|
|
9903
|
+
direct: "direct";
|
|
9904
|
+
group: "group";
|
|
9905
|
+
none: "none";
|
|
9906
|
+
}>>;
|
|
9907
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
9908
|
+
dueAt: z.ZodOptional<z.ZodISODateTime>;
|
|
9909
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
9910
|
+
open: "open";
|
|
9911
|
+
resolved: "resolved";
|
|
9912
|
+
}>>;
|
|
9913
|
+
}, z.core.$strict>;
|
|
9914
|
+
related: z.ZodObject<{
|
|
9915
|
+
thread: z.ZodString;
|
|
9916
|
+
from: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
9917
|
+
to: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
9918
|
+
cc: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
9919
|
+
}, z.core.$strict>;
|
|
9920
|
+
}, z.core.$strip>;
|
|
9921
|
+
|
|
9922
|
+
export declare type PluginSignalPublish = z.infer<typeof PluginSignalPublish>;
|
|
9923
|
+
|
|
9784
9924
|
declare const PluginSourceClass: z.ZodEnum<{
|
|
9785
9925
|
bundled: "bundled";
|
|
9786
9926
|
"org-shared": "org-shared";
|
package/dist/kay-app.js
CHANGED
|
@@ -1,3 +1,62 @@
|
|
|
1
|
+
// packages/plugin-protocol/dist/plugin-signal-limits.js
|
|
2
|
+
var PLUGIN_EVENT_REFUSED_ERROR_NAME = "PluginEventRefusedError";
|
|
3
|
+
var PLUGIN_SIGNAL_KINDS = [
|
|
4
|
+
"message",
|
|
5
|
+
"request",
|
|
6
|
+
"mention",
|
|
7
|
+
"invite",
|
|
8
|
+
"status"
|
|
9
|
+
];
|
|
10
|
+
var PLUGIN_SIGNAL_TITLE_MAX = 300;
|
|
11
|
+
var PLUGIN_SIGNAL_SNIPPET_MAX = 500;
|
|
12
|
+
var PLUGIN_SIGNAL_LABELS_MAX = 20;
|
|
13
|
+
var PLUGIN_SIGNAL_LABEL_MAX = 64;
|
|
14
|
+
var PLUGIN_SIGNAL_RELATED_KEYS = [
|
|
15
|
+
"thread",
|
|
16
|
+
"from",
|
|
17
|
+
"to",
|
|
18
|
+
"cc"
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
// packages/plugin-protocol/dist/credential-text.js
|
|
22
|
+
var CREDENTIAL_VALUE_PATTERNS = [
|
|
23
|
+
// Anthropic / OpenAI-style secret keys (`sk-`, `sk-ant-`, `sk-proj-`).
|
|
24
|
+
/^sk-[A-Za-z0-9_-]{16,}$/u,
|
|
25
|
+
// GitHub classic, fine-grained, app, and OAuth tokens.
|
|
26
|
+
/^gh[pousr]_[A-Za-z0-9]{16,}$/u,
|
|
27
|
+
/^github_pat_[A-Za-z0-9_]{20,}$/u,
|
|
28
|
+
// GitLab personal access tokens.
|
|
29
|
+
/^glpat-[A-Za-z0-9_-]{16,}$/u,
|
|
30
|
+
// Slack bot/user/app tokens.
|
|
31
|
+
/^xox[baprse]-[A-Za-z0-9-]{10,}$/u,
|
|
32
|
+
// AWS access key ids, long-lived and STS-issued.
|
|
33
|
+
/^(?:AKIA|ASIA)[0-9A-Z]{16}$/u,
|
|
34
|
+
// Google API keys, both published shapes.
|
|
35
|
+
/^AIza[0-9A-Za-z_-]{35}$/u,
|
|
36
|
+
/^AQ\.[A-Za-z0-9_-]{20,}$/u,
|
|
37
|
+
// npm automation tokens.
|
|
38
|
+
/^npm_[A-Za-z0-9]{30,}$/u,
|
|
39
|
+
// SendGrid API keys (SG.<key id>.<secret>).
|
|
40
|
+
/^SG\.[A-Za-z0-9_-]{16,}\.[A-Za-z0-9_-]{16,}$/u,
|
|
41
|
+
// HashiCorp Vault service/batch/recovery tokens.
|
|
42
|
+
/^hv[sbr]\.[A-Za-z0-9_-]{20,}$/u,
|
|
43
|
+
// Shopify access tokens.
|
|
44
|
+
/^shp(?:at|ss|ca|pa)_[a-fA-F0-9]{32}$/u,
|
|
45
|
+
// Stripe live/test secret and restricted keys.
|
|
46
|
+
/^(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}$/u,
|
|
47
|
+
// JSON Web Tokens - header.payload.signature, header always starts `eyJ`.
|
|
48
|
+
/^eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*$/u,
|
|
49
|
+
// A whole Authorization header value carried as data.
|
|
50
|
+
/^(?:Bearer|Basic) [A-Za-z0-9+/._~-]{16,}={0,2}$/iu,
|
|
51
|
+
// PEM private key blocks, anywhere in the string.
|
|
52
|
+
/-----BEGIN (?:[A-Z]+ )?PRIVATE KEY-----/u
|
|
53
|
+
];
|
|
54
|
+
function isCredentialShapedText(value) {
|
|
55
|
+
if (typeof value !== "string" || value.length === 0)
|
|
56
|
+
return false;
|
|
57
|
+
return CREDENTIAL_VALUE_PATTERNS.some((pattern) => pattern.test(value));
|
|
58
|
+
}
|
|
59
|
+
|
|
1
60
|
// packages/plugin-protocol/dist/json.js
|
|
2
61
|
import { z } from "zod";
|
|
3
62
|
var JsonValue = z.lazy(() => z.union([
|
|
@@ -655,6 +714,7 @@ function definePoller(app, localId, options) {
|
|
|
655
714
|
let initialized = 0;
|
|
656
715
|
let skipped = 0;
|
|
657
716
|
let failed = 0;
|
|
717
|
+
let refused = 0;
|
|
658
718
|
for (const { account, credential } of accounts) {
|
|
659
719
|
const saved = previous.find((entry) => entry.schemeId === account.schemeId && entry.accountId === account.accountId);
|
|
660
720
|
const name = `${account.schemeId}/${account.accountId}`;
|
|
@@ -682,15 +742,35 @@ function definePoller(app, localId, options) {
|
|
|
682
742
|
continue;
|
|
683
743
|
}
|
|
684
744
|
const toPublish = saved === void 0 ? [] : result.events ?? [];
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
745
|
+
let refusedHere = 0;
|
|
746
|
+
try {
|
|
747
|
+
refusedHere = await runStep(async () => {
|
|
748
|
+
let refusedInStep = 0;
|
|
749
|
+
for (const event of toPublish) {
|
|
750
|
+
try {
|
|
751
|
+
events.publish(event.localId, {
|
|
752
|
+
...event.input,
|
|
753
|
+
source: { poller: localId, runId }
|
|
754
|
+
});
|
|
755
|
+
} catch (error) {
|
|
756
|
+
if (!isPublishRefusal(error))
|
|
757
|
+
throw error;
|
|
758
|
+
refusedInStep++;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
return refusedInStep;
|
|
762
|
+
});
|
|
763
|
+
} catch (error) {
|
|
764
|
+
if (!isPublishRefusal(error))
|
|
765
|
+
throw error;
|
|
766
|
+
refusedHere = Math.max(refusedHere, refusedCountOf(error));
|
|
767
|
+
}
|
|
768
|
+
refused += refusedHere;
|
|
769
|
+
published += toPublish.length - refusedHere;
|
|
770
|
+
if (refusedHere > 0) {
|
|
771
|
+
const names = [...new Set(toPublish.map((event) => event.localId))];
|
|
772
|
+
details.push(`${name}: ${refusedHere} event(s) refused as invalid and skipped (${names.join(", ")})`);
|
|
773
|
+
}
|
|
694
774
|
if (saved === void 0)
|
|
695
775
|
initialized++;
|
|
696
776
|
next.push({
|
|
@@ -705,13 +785,20 @@ function definePoller(app, localId, options) {
|
|
|
705
785
|
return {
|
|
706
786
|
state: { accounts: next },
|
|
707
787
|
summary: {
|
|
708
|
-
headline: plainText(`${published} events; ${initialized} initialized; ${skipped} skipped; ${failed} failed`, 100),
|
|
788
|
+
headline: plainText(`${published} events; ${initialized} initialized; ${skipped} skipped; ${failed} failed${refused === 0 ? "" : `; ${refused} refused`}`, 100),
|
|
709
789
|
...details.length === 0 ? {} : { details: plainText(details.join("; "), 600) },
|
|
710
790
|
author: "automation"
|
|
711
791
|
}
|
|
712
792
|
};
|
|
713
793
|
});
|
|
714
794
|
}
|
|
795
|
+
function isPublishRefusal(error) {
|
|
796
|
+
return error instanceof Error && error.name === PLUGIN_EVENT_REFUSED_ERROR_NAME;
|
|
797
|
+
}
|
|
798
|
+
function refusedCountOf(error) {
|
|
799
|
+
const count = error.refusedCount;
|
|
800
|
+
return typeof count === "number" && Number.isSafeInteger(count) && count > 0 ? count : 1;
|
|
801
|
+
}
|
|
715
802
|
|
|
716
803
|
// packages/plugin-sdk/dist/kay-app/sealing.js
|
|
717
804
|
var KAY_APP_SEALING_MAX_BYTES = 1048576;
|
|
@@ -841,6 +928,13 @@ export {
|
|
|
841
928
|
KayAppCredentialRejectedError,
|
|
842
929
|
KayAppWorkflowFailure,
|
|
843
930
|
MAX_CHOICE_LABELS,
|
|
931
|
+
PLUGIN_EVENT_REFUSED_ERROR_NAME,
|
|
932
|
+
PLUGIN_SIGNAL_KINDS,
|
|
933
|
+
PLUGIN_SIGNAL_LABELS_MAX,
|
|
934
|
+
PLUGIN_SIGNAL_LABEL_MAX,
|
|
935
|
+
PLUGIN_SIGNAL_RELATED_KEYS,
|
|
936
|
+
PLUGIN_SIGNAL_SNIPPET_MAX,
|
|
937
|
+
PLUGIN_SIGNAL_TITLE_MAX,
|
|
844
938
|
SIGNAL_TIME_MAX_MS,
|
|
845
939
|
STORED_TRANSCRIPT_MESSAGE_FILTER,
|
|
846
940
|
STORED_TRANSCRIPT_MESSAGE_KINDS,
|
|
@@ -859,6 +953,7 @@ export {
|
|
|
859
953
|
definePoller,
|
|
860
954
|
failedRunCause,
|
|
861
955
|
invalidObservation,
|
|
956
|
+
isCredentialShapedText,
|
|
862
957
|
isRetryable,
|
|
863
958
|
parseLineSelector,
|
|
864
959
|
parseStoredTranscriptKindFilter,
|