@yaklabs-ai/plugin-sdk 0.37.1 → 0.38.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 +6 -1
- package/dist/kay-agent-testing.d.ts +7 -2
- package/dist/kay-agent.d.ts +10 -1
- package/dist/kay-app.d.ts +139 -3
- 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.38.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.38.0" },
|
|
66
66
|
"targets": {
|
|
67
67
|
"kay": {
|
|
68
68
|
"agent": {
|
package/dist/disclosure.d.ts
CHANGED
|
@@ -2399,8 +2399,13 @@ 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.
|
|
2402
2407
|
*/
|
|
2403
|
-
declare const KAY_PLUGIN_SDK_VERSION: "0.
|
|
2408
|
+
declare const KAY_PLUGIN_SDK_VERSION: "0.38.0";
|
|
2404
2409
|
|
|
2405
2410
|
declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
|
|
2406
2411
|
|
|
@@ -2453,8 +2453,13 @@ 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.
|
|
2456
2461
|
*/
|
|
2457
|
-
declare const KAY_PLUGIN_SDK_VERSION: "0.
|
|
2462
|
+
declare const KAY_PLUGIN_SDK_VERSION: "0.38.0";
|
|
2458
2463
|
|
|
2459
2464
|
declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
|
|
2460
2465
|
|
|
@@ -5652,9 +5657,9 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
|
|
|
5652
5657
|
pluginId: z.ZodString;
|
|
5653
5658
|
url: z.ZodString;
|
|
5654
5659
|
auth: z.ZodEnum<{
|
|
5660
|
+
none: "none";
|
|
5655
5661
|
oauth: "oauth";
|
|
5656
5662
|
"api-key": "api-key";
|
|
5657
|
-
none: "none";
|
|
5658
5663
|
}>;
|
|
5659
5664
|
authServiceId: z.ZodOptional<z.ZodString>;
|
|
5660
5665
|
}, z.core.$strict>>>;
|
package/dist/kay-agent.d.ts
CHANGED
|
@@ -2728,8 +2728,13 @@ 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.
|
|
2731
2736
|
*/
|
|
2732
|
-
declare const KAY_PLUGIN_SDK_VERSION: "0.
|
|
2737
|
+
declare const KAY_PLUGIN_SDK_VERSION: "0.38.0";
|
|
2733
2738
|
|
|
2734
2739
|
declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
|
|
2735
2740
|
|
|
@@ -5087,6 +5092,10 @@ declare const PluginCapabilityRefusalV1: z.ZodObject<{
|
|
|
5087
5092
|
target: z.ZodLiteral<"kay.app">;
|
|
5088
5093
|
slug: z.ZodLiteral<"workflows.define">;
|
|
5089
5094
|
envelope: z.ZodObject<{}, z.core.$strict>;
|
|
5095
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
5096
|
+
target: z.ZodLiteral<"kay.app">;
|
|
5097
|
+
slug: z.ZodLiteral<"workflows.signals">;
|
|
5098
|
+
envelope: z.ZodObject<{}, z.core.$strict>;
|
|
5090
5099
|
}, z.core.$strict>, z.ZodObject<{
|
|
5091
5100
|
target: z.ZodLiteral<"kay.app">;
|
|
5092
5101
|
slug: z.ZodLiteral<"session-events.subscribe">;
|
package/dist/kay-app.d.ts
CHANGED
|
@@ -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,13 @@ 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.
|
|
2693
2712
|
*/
|
|
2694
|
-
declare const KAY_PLUGIN_SDK_VERSION: "0.
|
|
2713
|
+
declare const KAY_PLUGIN_SDK_VERSION: "0.38.0";
|
|
2695
2714
|
|
|
2696
2715
|
declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
|
|
2697
2716
|
|
|
@@ -8317,6 +8336,22 @@ export declare interface KayAppWorkflows {
|
|
|
8317
8336
|
inspect(localId: string, options?: KayAppWorkflowInspectOptions): Promise<KayAppWorkflowInspection>;
|
|
8318
8337
|
}
|
|
8319
8338
|
|
|
8339
|
+
/**
|
|
8340
|
+
* Every event any plugin declares `signal: true`, from every plugin, including plugins installed
|
|
8341
|
+
* later. The payload of each is `PluginSignal` v1, and `related.thread` names its conversation or
|
|
8342
|
+
* object, so the workflow handles a new source without changing.
|
|
8343
|
+
*
|
|
8344
|
+
* Only a plugin Bonsai ships may define one: it asks for the private `workflows.signals` claim,
|
|
8345
|
+
* and any other plugin's activation is refused. `where` filters take envelope paths,
|
|
8346
|
+
* `related.thread|from|to|cc` and `payload.<PluginSignal field>`.
|
|
8347
|
+
*/
|
|
8348
|
+
export declare interface KayAppWorkflowSignalsTrigger {
|
|
8349
|
+
readonly kind: "plugin-event";
|
|
8350
|
+
readonly signals: true;
|
|
8351
|
+
readonly events?: undefined;
|
|
8352
|
+
readonly where?: KayAppAutomationPluginEventCondition["where"];
|
|
8353
|
+
}
|
|
8354
|
+
|
|
8320
8355
|
export declare type KayAppWorkflowTimeTrigger = Extract<KayAppAutomationConditionInput, {
|
|
8321
8356
|
readonly kind: "time";
|
|
8322
8357
|
}>;
|
|
@@ -8326,12 +8361,13 @@ export declare type KayAppWorkflowTimeTrigger = Extract<KayAppAutomationConditio
|
|
|
8326
8361
|
*
|
|
8327
8362
|
* An event trigger names full event types (`google.gmail.message.received`) and takes the same
|
|
8328
8363
|
* 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`.
|
|
8364
|
+
* plugin declares are accepted; another plugin's events are refused at `define`. The one way to
|
|
8365
|
+
* hear other plugins is {@link KayAppWorkflowSignalsTrigger}, for plugins Bonsai ships.
|
|
8330
8366
|
*
|
|
8331
8367
|
* A run is not started by an event that one of this workflow's own runs published, as long as the
|
|
8332
8368
|
* publish names the run: pass `source: { runId: ctx.runId }` (the Poller helper does).
|
|
8333
8369
|
*/
|
|
8334
|
-
export declare type KayAppWorkflowTrigger = KayAppWorkflowTimeTrigger | KayAppAutomationPluginEventCondition;
|
|
8370
|
+
export declare type KayAppWorkflowTrigger = KayAppWorkflowTimeTrigger | KayAppAutomationPluginEventCondition | KayAppWorkflowSignalsTrigger;
|
|
8335
8371
|
|
|
8336
8372
|
/**
|
|
8337
8373
|
* Read/arrange access to the live desktop workspace (tabs, panes, the shell chrome). Always
|
|
@@ -9711,6 +9747,26 @@ declare function Pick_2<Type extends TSchema, Indexer extends TSchema>(type: Typ
|
|
|
9711
9747
|
/** Creates a deferred Pick action. */
|
|
9712
9748
|
declare function PickDeferred<Type extends TSchema, Indexer extends TSchema>(type: Type, indexer: Indexer, options?: TSchemaOptions): TPickDeferred<Type, Indexer>;
|
|
9713
9749
|
|
|
9750
|
+
/**
|
|
9751
|
+
* The `name` of the error a host throws when it refuses a publish because the event is invalid.
|
|
9752
|
+
* A publisher skips such an event; any other publish failure may be transient.
|
|
9753
|
+
*/
|
|
9754
|
+
export declare const PLUGIN_EVENT_REFUSED_ERROR_NAME = "PluginEventRefusedError";
|
|
9755
|
+
|
|
9756
|
+
/** The `kind` values of `PluginSignal` v1. `status` is system state that clears itself. */
|
|
9757
|
+
export declare const PLUGIN_SIGNAL_KINDS: readonly ["message", "request", "mention", "invite", "status"];
|
|
9758
|
+
|
|
9759
|
+
export declare const PLUGIN_SIGNAL_LABEL_MAX = 64;
|
|
9760
|
+
|
|
9761
|
+
export declare const PLUGIN_SIGNAL_LABELS_MAX = 20;
|
|
9762
|
+
|
|
9763
|
+
/** The `related` keys a signal may use; `thread` is required on every signal publish. */
|
|
9764
|
+
export declare const PLUGIN_SIGNAL_RELATED_KEYS: readonly ["thread", "from", "to", "cc"];
|
|
9765
|
+
|
|
9766
|
+
export declare const PLUGIN_SIGNAL_SNIPPET_MAX = 500;
|
|
9767
|
+
|
|
9768
|
+
export declare const PLUGIN_SIGNAL_TITLE_MAX = 300;
|
|
9769
|
+
|
|
9714
9770
|
export declare const PluginAgentDefinitionPermissionRule: z.ZodObject<{
|
|
9715
9771
|
effect: z.ZodEnum<{
|
|
9716
9772
|
allow: "allow";
|
|
@@ -9781,6 +9837,86 @@ declare const PluginNamespace: z.ZodString;
|
|
|
9781
9837
|
|
|
9782
9838
|
declare type PluginNamespace = z.infer<typeof PluginNamespace>;
|
|
9783
9839
|
|
|
9840
|
+
export declare const PluginSignal: z.ZodObject<{
|
|
9841
|
+
kind: z.ZodEnum<{
|
|
9842
|
+
message: "message";
|
|
9843
|
+
status: "status";
|
|
9844
|
+
request: "request";
|
|
9845
|
+
mention: "mention";
|
|
9846
|
+
invite: "invite";
|
|
9847
|
+
}>;
|
|
9848
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
9849
|
+
out: "out";
|
|
9850
|
+
in: "in";
|
|
9851
|
+
}>>;
|
|
9852
|
+
title: z.ZodOptional<z.ZodString>;
|
|
9853
|
+
snippet: z.ZodOptional<z.ZodString>;
|
|
9854
|
+
actor: z.ZodOptional<z.ZodObject<{
|
|
9855
|
+
name: z.ZodOptional<z.ZodString>;
|
|
9856
|
+
uri: z.ZodString;
|
|
9857
|
+
}, z.core.$strict>>;
|
|
9858
|
+
addressed: z.ZodOptional<z.ZodEnum<{
|
|
9859
|
+
mention: "mention";
|
|
9860
|
+
cc: "cc";
|
|
9861
|
+
direct: "direct";
|
|
9862
|
+
group: "group";
|
|
9863
|
+
none: "none";
|
|
9864
|
+
}>>;
|
|
9865
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
9866
|
+
dueAt: z.ZodOptional<z.ZodISODateTime>;
|
|
9867
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
9868
|
+
open: "open";
|
|
9869
|
+
resolved: "resolved";
|
|
9870
|
+
}>>;
|
|
9871
|
+
}, z.core.$strict>;
|
|
9872
|
+
|
|
9873
|
+
export declare type PluginSignal = z.infer<typeof PluginSignal>;
|
|
9874
|
+
|
|
9875
|
+
export declare type PluginSignalKind = (typeof PLUGIN_SIGNAL_KINDS)[number];
|
|
9876
|
+
|
|
9877
|
+
export declare const PluginSignalPublish: z.ZodObject<{
|
|
9878
|
+
payload: z.ZodObject<{
|
|
9879
|
+
kind: z.ZodEnum<{
|
|
9880
|
+
message: "message";
|
|
9881
|
+
status: "status";
|
|
9882
|
+
request: "request";
|
|
9883
|
+
mention: "mention";
|
|
9884
|
+
invite: "invite";
|
|
9885
|
+
}>;
|
|
9886
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
9887
|
+
out: "out";
|
|
9888
|
+
in: "in";
|
|
9889
|
+
}>>;
|
|
9890
|
+
title: z.ZodOptional<z.ZodString>;
|
|
9891
|
+
snippet: z.ZodOptional<z.ZodString>;
|
|
9892
|
+
actor: z.ZodOptional<z.ZodObject<{
|
|
9893
|
+
name: z.ZodOptional<z.ZodString>;
|
|
9894
|
+
uri: z.ZodString;
|
|
9895
|
+
}, z.core.$strict>>;
|
|
9896
|
+
addressed: z.ZodOptional<z.ZodEnum<{
|
|
9897
|
+
mention: "mention";
|
|
9898
|
+
cc: "cc";
|
|
9899
|
+
direct: "direct";
|
|
9900
|
+
group: "group";
|
|
9901
|
+
none: "none";
|
|
9902
|
+
}>>;
|
|
9903
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
9904
|
+
dueAt: z.ZodOptional<z.ZodISODateTime>;
|
|
9905
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
9906
|
+
open: "open";
|
|
9907
|
+
resolved: "resolved";
|
|
9908
|
+
}>>;
|
|
9909
|
+
}, z.core.$strict>;
|
|
9910
|
+
related: z.ZodObject<{
|
|
9911
|
+
thread: z.ZodString;
|
|
9912
|
+
from: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
9913
|
+
to: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
9914
|
+
cc: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
9915
|
+
}, z.core.$strict>;
|
|
9916
|
+
}, z.core.$strip>;
|
|
9917
|
+
|
|
9918
|
+
export declare type PluginSignalPublish = z.infer<typeof PluginSignalPublish>;
|
|
9919
|
+
|
|
9784
9920
|
declare const PluginSourceClass: z.ZodEnum<{
|
|
9785
9921
|
bundled: "bundled";
|
|
9786
9922
|
"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,
|