@executor-js/sdk 0.2.0 → 1.4.20
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/{chunk-FPV6KONN.js → chunk-I2OEQ2GJ.js} +33 -8
- package/dist/chunk-I2OEQ2GJ.js.map +1 -0
- package/dist/{chunk-VLVPSIQ4.js → chunk-OIJL6F6M.js} +111 -136
- package/dist/chunk-OIJL6F6M.js.map +1 -0
- package/dist/connections.d.ts +33 -22
- package/dist/connections.d.ts.map +1 -1
- package/dist/core.js +5 -5
- package/dist/core.js.map +1 -1
- package/dist/credential-bindings.d.ts +42 -45
- package/dist/credential-bindings.d.ts.map +1 -1
- package/dist/elicitation.d.ts +11 -14
- package/dist/elicitation.d.ts.map +1 -1
- package/dist/executor.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/oauth-popup-types.d.ts +3 -0
- package/dist/oauth-popup-types.d.ts.map +1 -1
- package/dist/plugin.d.ts +25 -5
- package/dist/plugin.d.ts.map +1 -1
- package/dist/promise-executor.d.ts.map +1 -1
- package/dist/scope.d.ts +3 -5
- package/dist/scope.d.ts.map +1 -1
- package/dist/secrets.d.ts +9 -13
- package/dist/secrets.d.ts.map +1 -1
- package/dist/testing.js +2 -2
- package/dist/types.d.ts +6 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/usages.d.ts +3 -5
- package/dist/usages.d.ts.map +1 -1
- package/package.json +3 -2
- package/dist/chunk-FPV6KONN.js.map +0 -1
- package/dist/chunk-VLVPSIQ4.js.map +0 -1
|
@@ -67,7 +67,7 @@ var CredentialBindingId = Schema.String.pipe(Schema.brand("CredentialBindingId")
|
|
|
67
67
|
// src/connections.ts
|
|
68
68
|
import { Data, Schema as Schema2 } from "effect";
|
|
69
69
|
var ConnectionProviderState = Schema2.Record(Schema2.String, Schema2.Unknown);
|
|
70
|
-
var ConnectionRef =
|
|
70
|
+
var ConnectionRef = Schema2.Struct({
|
|
71
71
|
id: ConnectionId,
|
|
72
72
|
scopeId: ScopeId,
|
|
73
73
|
provider: Schema2.String,
|
|
@@ -82,9 +82,8 @@ var ConnectionRef = class extends Schema2.Class("ConnectionRef")({
|
|
|
82
82
|
providerState: Schema2.NullOr(ConnectionProviderState),
|
|
83
83
|
createdAt: Schema2.Date,
|
|
84
84
|
updatedAt: Schema2.Date
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
var TokenMaterial = class extends Schema2.Class("TokenMaterial")({
|
|
85
|
+
});
|
|
86
|
+
var TokenMaterial = Schema2.Struct({
|
|
88
87
|
/** Target secret id. Plugins typically derive this from the source id
|
|
89
88
|
* + a stable suffix (e.g. `${sourceId}.access_token`). */
|
|
90
89
|
secretId: SecretId,
|
|
@@ -92,11 +91,8 @@ var TokenMaterial = class extends Schema2.Class("TokenMaterial")({
|
|
|
92
91
|
* Connections UI hides connection-owned secrets. */
|
|
93
92
|
name: Schema2.String,
|
|
94
93
|
value: Schema2.String
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
var CreateConnectionInput = class extends Schema2.Class(
|
|
98
|
-
"CreateConnectionInput"
|
|
99
|
-
)({
|
|
94
|
+
});
|
|
95
|
+
var CreateConnectionInput = Schema2.Struct({
|
|
100
96
|
id: ConnectionId,
|
|
101
97
|
/** Executor scope id that will own this connection + its backing
|
|
102
98
|
* secrets. This is the sharing boundary: a user scope is personal,
|
|
@@ -110,13 +106,10 @@ var CreateConnectionInput = class extends Schema2.Class(
|
|
|
110
106
|
/** OAuth-style scope string. Distinct from the executor scope above. */
|
|
111
107
|
oauthScope: Schema2.NullOr(Schema2.String),
|
|
112
108
|
providerState: Schema2.NullOr(ConnectionProviderState)
|
|
113
|
-
})
|
|
114
|
-
};
|
|
109
|
+
});
|
|
115
110
|
var ConnectionRefreshError = class extends Data.TaggedError("ConnectionRefreshError") {
|
|
116
111
|
};
|
|
117
|
-
var UpdateConnectionTokensInput =
|
|
118
|
-
"UpdateConnectionTokensInput"
|
|
119
|
-
)({
|
|
112
|
+
var UpdateConnectionTokensInput = Schema2.Struct({
|
|
120
113
|
id: ConnectionId,
|
|
121
114
|
accessToken: Schema2.String,
|
|
122
115
|
refreshToken: Schema2.optional(Schema2.NullOr(Schema2.String)),
|
|
@@ -124,16 +117,12 @@ var UpdateConnectionTokensInput = class extends Schema2.Class(
|
|
|
124
117
|
oauthScope: Schema2.optional(Schema2.NullOr(Schema2.String)),
|
|
125
118
|
providerState: Schema2.optional(Schema2.NullOr(ConnectionProviderState)),
|
|
126
119
|
identityLabel: Schema2.optional(Schema2.NullOr(Schema2.String))
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
var RemoveConnectionInput = class extends Schema2.Class(
|
|
130
|
-
"RemoveConnectionInput"
|
|
131
|
-
)({
|
|
120
|
+
});
|
|
121
|
+
var RemoveConnectionInput = Schema2.Struct({
|
|
132
122
|
id: ConnectionId,
|
|
133
123
|
/** Scope id whose connection row and owned token secrets should be removed. */
|
|
134
124
|
targetScope: ScopeId
|
|
135
|
-
})
|
|
136
|
-
};
|
|
125
|
+
});
|
|
137
126
|
|
|
138
127
|
// src/core-schema.ts
|
|
139
128
|
var credentialBindingKinds = ["text", "secret", "connection"];
|
|
@@ -364,29 +353,19 @@ var CredentialBindingValue = Schema3.Union([
|
|
|
364
353
|
connectionId: ConnectionId
|
|
365
354
|
})
|
|
366
355
|
]);
|
|
367
|
-
var
|
|
356
|
+
var ConfiguredCredentialBinding = Schema3.Struct({
|
|
368
357
|
kind: Schema3.Literal("binding"),
|
|
369
358
|
slot: Schema3.String,
|
|
370
359
|
prefix: Schema3.optional(Schema3.String)
|
|
371
360
|
});
|
|
372
|
-
var ConfiguredCredentialBinding = class extends Schema3.Class(
|
|
373
|
-
"ConfiguredCredentialBinding"
|
|
374
|
-
)(ConfiguredCredentialBindingSchema.fields) {
|
|
375
|
-
};
|
|
376
361
|
var ConfiguredCredentialValue = Schema3.Union([Schema3.String, ConfiguredCredentialBinding]);
|
|
377
|
-
var ConfiguredCredentialValueSchema = Schema3.Union([
|
|
378
|
-
Schema3.String,
|
|
379
|
-
ConfiguredCredentialBindingSchema
|
|
380
|
-
]);
|
|
381
362
|
var ScopedSecretCredentialInput = Schema3.Struct({
|
|
382
363
|
secretId: Schema3.String,
|
|
383
364
|
prefix: Schema3.optional(Schema3.String),
|
|
384
365
|
targetScope: ScopeId,
|
|
385
366
|
secretScopeId: Schema3.optional(ScopeId)
|
|
386
367
|
});
|
|
387
|
-
var CredentialBindingRef =
|
|
388
|
-
"CredentialBindingRef"
|
|
389
|
-
)({
|
|
368
|
+
var CredentialBindingRef = Schema3.Struct({
|
|
390
369
|
id: CredentialBindingId,
|
|
391
370
|
scopeId: ScopeId,
|
|
392
371
|
pluginId: Schema3.String,
|
|
@@ -396,72 +375,51 @@ var CredentialBindingRef = class extends Schema3.Class(
|
|
|
396
375
|
value: CredentialBindingValue,
|
|
397
376
|
createdAt: Schema3.Date,
|
|
398
377
|
updatedAt: Schema3.Date
|
|
399
|
-
})
|
|
400
|
-
|
|
401
|
-
var SetCredentialBindingInput = class extends Schema3.Class(
|
|
402
|
-
"SetCredentialBindingInput"
|
|
403
|
-
)({
|
|
378
|
+
});
|
|
379
|
+
var SetCredentialBindingInput = Schema3.Struct({
|
|
404
380
|
targetScope: ScopeId,
|
|
405
381
|
pluginId: Schema3.String,
|
|
406
382
|
sourceId: Schema3.String,
|
|
407
383
|
sourceScope: ScopeId,
|
|
408
384
|
slotKey: Schema3.String,
|
|
409
385
|
value: CredentialBindingValue
|
|
410
|
-
})
|
|
411
|
-
|
|
412
|
-
var CredentialBindingSourceInput = class extends Schema3.Class(
|
|
413
|
-
"CredentialBindingSourceInput"
|
|
414
|
-
)({
|
|
386
|
+
});
|
|
387
|
+
var CredentialBindingSourceInput = Schema3.Struct({
|
|
415
388
|
pluginId: Schema3.String,
|
|
416
389
|
sourceId: Schema3.String,
|
|
417
390
|
sourceScope: ScopeId
|
|
418
|
-
})
|
|
419
|
-
|
|
420
|
-
var CredentialBindingSlotInput = class extends Schema3.Class(
|
|
421
|
-
"CredentialBindingSlotInput"
|
|
422
|
-
)({
|
|
391
|
+
});
|
|
392
|
+
var CredentialBindingSlotInput = Schema3.Struct({
|
|
423
393
|
pluginId: Schema3.String,
|
|
424
394
|
sourceId: Schema3.String,
|
|
425
395
|
sourceScope: ScopeId,
|
|
426
396
|
slotKey: Schema3.String
|
|
427
|
-
})
|
|
428
|
-
|
|
429
|
-
var RemoveCredentialBindingInput = class extends Schema3.Class(
|
|
430
|
-
"RemoveCredentialBindingInput"
|
|
431
|
-
)({
|
|
397
|
+
});
|
|
398
|
+
var RemoveCredentialBindingInput = Schema3.Struct({
|
|
432
399
|
targetScope: ScopeId,
|
|
433
400
|
pluginId: Schema3.String,
|
|
434
401
|
sourceId: Schema3.String,
|
|
435
402
|
sourceScope: ScopeId,
|
|
436
403
|
slotKey: Schema3.String
|
|
437
|
-
})
|
|
438
|
-
|
|
439
|
-
var ReplaceCredentialBindingValue = class extends Schema3.Class(
|
|
440
|
-
"ReplaceCredentialBindingValue"
|
|
441
|
-
)({
|
|
404
|
+
});
|
|
405
|
+
var ReplaceCredentialBindingValue = Schema3.Struct({
|
|
442
406
|
slotKey: Schema3.String,
|
|
443
407
|
value: CredentialBindingValue
|
|
444
|
-
})
|
|
445
|
-
|
|
446
|
-
var ReplaceCredentialBindingsInput = class extends Schema3.Class(
|
|
447
|
-
"ReplaceCredentialBindingsInput"
|
|
448
|
-
)({
|
|
408
|
+
});
|
|
409
|
+
var ReplaceCredentialBindingsInput = Schema3.Struct({
|
|
449
410
|
targetScope: ScopeId,
|
|
450
411
|
pluginId: Schema3.String,
|
|
451
412
|
sourceId: Schema3.String,
|
|
452
413
|
sourceScope: ScopeId,
|
|
453
414
|
slotPrefixes: Schema3.Array(Schema3.String),
|
|
454
415
|
bindings: Schema3.Array(ReplaceCredentialBindingValue)
|
|
455
|
-
})
|
|
456
|
-
};
|
|
416
|
+
});
|
|
457
417
|
var CredentialBindingResolutionStatus = Schema3.Literals([
|
|
458
418
|
"resolved",
|
|
459
419
|
"missing",
|
|
460
420
|
"blocked"
|
|
461
421
|
]);
|
|
462
|
-
var ResolvedCredentialSlot =
|
|
463
|
-
"ResolvedCredentialSlot"
|
|
464
|
-
)({
|
|
422
|
+
var ResolvedCredentialSlot = Schema3.Struct({
|
|
465
423
|
pluginId: Schema3.String,
|
|
466
424
|
sourceId: Schema3.String,
|
|
467
425
|
sourceScopeId: ScopeId,
|
|
@@ -469,8 +427,7 @@ var ResolvedCredentialSlot = class extends Schema3.Class(
|
|
|
469
427
|
bindingScopeId: Schema3.NullOr(ScopeId),
|
|
470
428
|
kind: Schema3.NullOr(CredentialBindingKind),
|
|
471
429
|
status: CredentialBindingResolutionStatus
|
|
472
|
-
})
|
|
473
|
-
};
|
|
430
|
+
});
|
|
474
431
|
var credentialBindingId = (input) => CredentialBindingId.make(
|
|
475
432
|
JSON.stringify([input.pluginId, input.sourceScope, input.sourceId, input.slotKey])
|
|
476
433
|
);
|
|
@@ -494,7 +451,7 @@ var credentialBindingValueFromRow = (row) => Match.value(row).pipe(
|
|
|
494
451
|
);
|
|
495
452
|
var credentialBindingRowToRef = (row) => {
|
|
496
453
|
const value = credentialBindingValueFromRow(row);
|
|
497
|
-
return
|
|
454
|
+
return CredentialBindingRef.make({
|
|
498
455
|
id: CredentialBindingId.make(row.id),
|
|
499
456
|
scopeId: ScopeId.make(row.scope_id),
|
|
500
457
|
pluginId: row.plugin_id,
|
|
@@ -509,26 +466,23 @@ var credentialBindingRowToRef = (row) => {
|
|
|
509
466
|
|
|
510
467
|
// src/elicitation.ts
|
|
511
468
|
import { Schema as Schema4 } from "effect";
|
|
512
|
-
var FormElicitation =
|
|
469
|
+
var FormElicitation = Schema4.TaggedStruct("FormElicitation", {
|
|
513
470
|
message: Schema4.String,
|
|
514
471
|
/** JSON Schema describing the fields to collect */
|
|
515
472
|
requestedSchema: Schema4.Record(Schema4.String, Schema4.Unknown)
|
|
516
|
-
})
|
|
517
|
-
|
|
518
|
-
var UrlElicitation = class extends Schema4.TaggedClass()("UrlElicitation", {
|
|
473
|
+
});
|
|
474
|
+
var UrlElicitation = Schema4.TaggedStruct("UrlElicitation", {
|
|
519
475
|
message: Schema4.String,
|
|
520
476
|
url: Schema4.String,
|
|
521
477
|
/** Unique ID so the host can correlate the callback */
|
|
522
478
|
elicitationId: Schema4.String
|
|
523
|
-
})
|
|
524
|
-
};
|
|
479
|
+
});
|
|
525
480
|
var ElicitationAction = Schema4.Literals(["accept", "decline", "cancel"]);
|
|
526
|
-
var ElicitationResponse =
|
|
481
|
+
var ElicitationResponse = Schema4.Struct({
|
|
527
482
|
action: ElicitationAction,
|
|
528
483
|
/** Present when action is "accept" — the data the user provided */
|
|
529
484
|
content: Schema4.optional(Schema4.Record(Schema4.String, Schema4.Unknown))
|
|
530
|
-
})
|
|
531
|
-
};
|
|
485
|
+
});
|
|
532
486
|
var ElicitationDeclinedError = class extends Schema4.TaggedErrorClass()(
|
|
533
487
|
"ElicitationDeclinedError",
|
|
534
488
|
{
|
|
@@ -648,7 +602,7 @@ var ConnectionInUseError = class extends Schema5.TaggedErrorClass()(
|
|
|
648
602
|
|
|
649
603
|
// src/secrets.ts
|
|
650
604
|
import { Schema as Schema6 } from "effect";
|
|
651
|
-
var SecretRef =
|
|
605
|
+
var SecretRef = Schema6.Struct({
|
|
652
606
|
id: SecretId,
|
|
653
607
|
scopeId: ScopeId,
|
|
654
608
|
/** Human-readable label (e.g. "Cloudflare API Token") */
|
|
@@ -656,9 +610,8 @@ var SecretRef = class extends Schema6.Class("SecretRef")({
|
|
|
656
610
|
/** Which provider holds the value */
|
|
657
611
|
provider: Schema6.String,
|
|
658
612
|
createdAt: Schema6.Date
|
|
659
|
-
})
|
|
660
|
-
|
|
661
|
-
var SetSecretInput = class extends Schema6.Class("SetSecretInput")({
|
|
613
|
+
});
|
|
614
|
+
var SetSecretInput = Schema6.Struct({
|
|
662
615
|
id: SecretId,
|
|
663
616
|
/** Scope id to own this secret. Must be one of the executor's
|
|
664
617
|
* configured scopes. */
|
|
@@ -670,15 +623,13 @@ var SetSecretInput = class extends Schema6.Class("SetSecretInput")({
|
|
|
670
623
|
/** Optional provider routing. If unset the executor picks the first
|
|
671
624
|
* writable provider in registration order. */
|
|
672
625
|
provider: Schema6.optional(Schema6.String)
|
|
673
|
-
})
|
|
674
|
-
|
|
675
|
-
var RemoveSecretInput = class extends Schema6.Class("RemoveSecretInput")({
|
|
626
|
+
});
|
|
627
|
+
var RemoveSecretInput = Schema6.Struct({
|
|
676
628
|
id: SecretId,
|
|
677
629
|
/** Scope id whose secret row/value should be removed. Must be one of
|
|
678
630
|
* the executor's configured scopes. */
|
|
679
631
|
targetScope: ScopeId
|
|
680
|
-
})
|
|
681
|
-
};
|
|
632
|
+
});
|
|
682
633
|
|
|
683
634
|
// src/oauth.ts
|
|
684
635
|
import { Effect as Effect6, Schema as Schema7 } from "effect";
|
|
@@ -1884,12 +1835,12 @@ var makeOAuth2Service = (deps) => {
|
|
|
1884
1835
|
scope: tokens.scope ?? null
|
|
1885
1836
|
};
|
|
1886
1837
|
yield* deps.connectionsCreate(
|
|
1887
|
-
|
|
1838
|
+
CreateConnectionInput.make({
|
|
1888
1839
|
id: ConnectionId.make(input.connectionId),
|
|
1889
1840
|
scope: ScopeId.make(input.tokenScope),
|
|
1890
1841
|
provider: OAUTH2_PROVIDER_KEY,
|
|
1891
1842
|
identityLabel: input.identityLabel ?? safeHostname(input.endpoint),
|
|
1892
|
-
accessToken:
|
|
1843
|
+
accessToken: TokenMaterial.make({
|
|
1893
1844
|
secretId: SecretId.make(oauthSecretId(input.connectionId, "access-token")),
|
|
1894
1845
|
name: "OAuth Access Token",
|
|
1895
1846
|
value: tokens.access_token
|
|
@@ -2013,7 +1964,7 @@ var makeOAuth2Service = (deps) => {
|
|
|
2013
1964
|
}
|
|
2014
1965
|
const secretId = oauthSecretId(connectionId, "client-secret");
|
|
2015
1966
|
return deps.secretsSet(
|
|
2016
|
-
|
|
1967
|
+
SetSecretInput.make({
|
|
2017
1968
|
id: SecretId.make(secretId),
|
|
2018
1969
|
scope: ScopeId.make(tokenScope),
|
|
2019
1970
|
name: "OAuth Client Secret",
|
|
@@ -2063,19 +2014,19 @@ var makeOAuth2Service = (deps) => {
|
|
|
2063
2014
|
scope: exchangeResult.tokens.scope ?? null
|
|
2064
2015
|
};
|
|
2065
2016
|
yield* deps.connectionsCreate(
|
|
2066
|
-
|
|
2017
|
+
CreateConnectionInput.make({
|
|
2067
2018
|
id: ConnectionId.make(connectionId),
|
|
2068
2019
|
scope: ScopeId.make(tokenScope),
|
|
2069
2020
|
provider: OAUTH2_PROVIDER_KEY,
|
|
2070
2021
|
identityLabel: safeHostname(
|
|
2071
2022
|
payload.identityLabel ?? exchangeResult.endpointForDisplay ?? endpoint
|
|
2072
2023
|
),
|
|
2073
|
-
accessToken:
|
|
2024
|
+
accessToken: TokenMaterial.make({
|
|
2074
2025
|
secretId: SecretId.make(oauthSecretId(connectionId, "access-token")),
|
|
2075
2026
|
name: "OAuth Access Token",
|
|
2076
2027
|
value: exchangeResult.tokens.access_token
|
|
2077
2028
|
}),
|
|
2078
|
-
refreshToken: exchangeResult.tokens.refresh_token ?
|
|
2029
|
+
refreshToken: exchangeResult.tokens.refresh_token ? TokenMaterial.make({
|
|
2079
2030
|
secretId: SecretId.make(oauthSecretId(connectionId, "refresh-token")),
|
|
2080
2031
|
name: "OAuth Refresh Token",
|
|
2081
2032
|
value: exchangeResult.tokens.refresh_token
|
|
@@ -2497,19 +2448,18 @@ var ToolPolicyActionSchema = Schema10.Literals(["approve", "require_approval", "
|
|
|
2497
2448
|
|
|
2498
2449
|
// src/usages.ts
|
|
2499
2450
|
import { Schema as Schema11 } from "effect";
|
|
2500
|
-
var Usage =
|
|
2451
|
+
var Usage = Schema11.Struct({
|
|
2501
2452
|
pluginId: Schema11.String,
|
|
2502
2453
|
scopeId: ScopeId,
|
|
2503
2454
|
ownerKind: Schema11.String,
|
|
2504
2455
|
ownerId: Schema11.String,
|
|
2505
2456
|
ownerName: Schema11.NullOr(Schema11.String),
|
|
2506
2457
|
slot: Schema11.String
|
|
2507
|
-
})
|
|
2508
|
-
};
|
|
2458
|
+
});
|
|
2509
2459
|
|
|
2510
2460
|
// src/types.ts
|
|
2511
2461
|
import { Schema as Schema12 } from "effect";
|
|
2512
|
-
var ToolSchema =
|
|
2462
|
+
var ToolSchema = Schema12.Struct({
|
|
2513
2463
|
id: ToolId,
|
|
2514
2464
|
name: Schema12.optional(Schema12.String),
|
|
2515
2465
|
description: Schema12.optional(Schema12.String),
|
|
@@ -2518,11 +2468,8 @@ var ToolSchema = class extends Schema12.Class("ToolSchema")({
|
|
|
2518
2468
|
inputTypeScript: Schema12.optional(Schema12.String),
|
|
2519
2469
|
outputTypeScript: Schema12.optional(Schema12.String),
|
|
2520
2470
|
typeScriptDefinitions: Schema12.optional(Schema12.Record(Schema12.String, Schema12.String))
|
|
2521
|
-
})
|
|
2522
|
-
|
|
2523
|
-
var SourceDetectionResult = class extends Schema12.Class(
|
|
2524
|
-
"SourceDetectionResult"
|
|
2525
|
-
)({
|
|
2471
|
+
});
|
|
2472
|
+
var SourceDetectionResult = Schema12.Struct({
|
|
2526
2473
|
/** Plugin id that recognized the URL (e.g. "openapi", "graphql"). */
|
|
2527
2474
|
kind: Schema12.String,
|
|
2528
2475
|
/** Confidence tier — UI uses this to pick a winner when multiple
|
|
@@ -2536,8 +2483,7 @@ var SourceDetectionResult = class extends Schema12.Class(
|
|
|
2536
2483
|
/** Namespace suggestion — the plugin's recommendation for the source
|
|
2537
2484
|
* id. UI may override. */
|
|
2538
2485
|
namespace: Schema12.String
|
|
2539
|
-
})
|
|
2540
|
-
};
|
|
2486
|
+
});
|
|
2541
2487
|
|
|
2542
2488
|
// src/schema-types.ts
|
|
2543
2489
|
import { Match as Match4, Option as Option3 } from "effect";
|
|
@@ -3060,7 +3006,7 @@ var scopeAdapter = (inner, ctx, schema) => {
|
|
|
3060
3006
|
// src/executor.ts
|
|
3061
3007
|
var MAX_ANNOTATION_GROUPS = 64;
|
|
3062
3008
|
var MAX_APPROVAL_ARGUMENT_PREVIEW_CHARS = 4e3;
|
|
3063
|
-
var acceptAllHandler = () => Effect12.succeed(
|
|
3009
|
+
var acceptAllHandler = () => Effect12.succeed(ElicitationResponse.make({ action: "accept" }));
|
|
3064
3010
|
var resolveElicitationHandler = (onElicitation) => onElicitation === "accept-all" ? acceptAllHandler : onElicitation;
|
|
3065
3011
|
var collectSchemas = (plugins) => {
|
|
3066
3012
|
const merged = { ...coreSchema };
|
|
@@ -3125,10 +3071,26 @@ var staticDeclToTool = (source, tool, pluginId) => ({
|
|
|
3125
3071
|
pluginId,
|
|
3126
3072
|
name: tool.name,
|
|
3127
3073
|
description: tool.description,
|
|
3128
|
-
inputSchema: tool.inputSchema,
|
|
3129
|
-
outputSchema: tool.outputSchema,
|
|
3074
|
+
inputSchema: toToolJsonSchema(tool.inputSchema),
|
|
3075
|
+
outputSchema: toToolJsonSchema(tool.outputSchema, "output"),
|
|
3130
3076
|
annotations: tool.annotations
|
|
3131
3077
|
});
|
|
3078
|
+
var toToolJsonSchema = (schema, direction = "input") => {
|
|
3079
|
+
if (schema == null) return void 0;
|
|
3080
|
+
return schema["~standard"].jsonSchema[direction]({
|
|
3081
|
+
target: "draft-2020-12"
|
|
3082
|
+
});
|
|
3083
|
+
};
|
|
3084
|
+
var EXECUTOR_SOURCE_ID = "executor";
|
|
3085
|
+
var EXECUTOR_SOURCE = {
|
|
3086
|
+
id: EXECUTOR_SOURCE_ID,
|
|
3087
|
+
kind: "built-in",
|
|
3088
|
+
name: "Executor",
|
|
3089
|
+
canRemove: false,
|
|
3090
|
+
canRefresh: false,
|
|
3091
|
+
canEdit: false,
|
|
3092
|
+
tools: []
|
|
3093
|
+
};
|
|
3132
3094
|
var writeSourceInput = (core, pluginId, input) => Effect12.gen(function* () {
|
|
3133
3095
|
yield* deleteSourceById(core, input.id, input.scope);
|
|
3134
3096
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -3489,7 +3451,7 @@ var createExecutor = (config) => Effect12.gen(function* () {
|
|
|
3489
3451
|
},
|
|
3490
3452
|
forceAllowId: true
|
|
3491
3453
|
});
|
|
3492
|
-
return
|
|
3454
|
+
return SecretRef.make({
|
|
3493
3455
|
id: input.id,
|
|
3494
3456
|
scopeId: input.scope,
|
|
3495
3457
|
name: input.name,
|
|
@@ -3642,7 +3604,7 @@ var createExecutor = (config) => Effect12.gen(function* () {
|
|
|
3642
3604
|
}
|
|
3643
3605
|
byId.set(
|
|
3644
3606
|
row.id,
|
|
3645
|
-
|
|
3607
|
+
SecretRef.make({
|
|
3646
3608
|
id: SecretId.make(row.id),
|
|
3647
3609
|
scopeId: ScopeId.make(incomingScope),
|
|
3648
3610
|
name: row.name,
|
|
@@ -3668,7 +3630,7 @@ var createExecutor = (config) => Effect12.gen(function* () {
|
|
|
3668
3630
|
if (connectionOwnedIds.has(entry.id)) continue;
|
|
3669
3631
|
byId.set(
|
|
3670
3632
|
entry.id,
|
|
3671
|
-
|
|
3633
|
+
SecretRef.make({
|
|
3672
3634
|
id: SecretId.make(entry.id),
|
|
3673
3635
|
scopeId: ScopeId.make(innermostScopeId),
|
|
3674
3636
|
name: entry.name,
|
|
@@ -3691,7 +3653,7 @@ var createExecutor = (config) => Effect12.gen(function* () {
|
|
|
3691
3653
|
const hasBackingValue = yield* secretRouteHasBackingValue(row);
|
|
3692
3654
|
if (!hasBackingValue) continue;
|
|
3693
3655
|
refs.push(
|
|
3694
|
-
|
|
3656
|
+
SecretRef.make({
|
|
3695
3657
|
id: SecretId.make(row.id),
|
|
3696
3658
|
scopeId: ScopeId.make(row.scope_id),
|
|
3697
3659
|
name: row.name,
|
|
@@ -3716,7 +3678,7 @@ var createExecutor = (config) => Effect12.gen(function* () {
|
|
|
3716
3678
|
}));
|
|
3717
3679
|
});
|
|
3718
3680
|
const CONNECTION_REFRESH_SKEW_MS = 6e4;
|
|
3719
|
-
const rowToConnection = (row) =>
|
|
3681
|
+
const rowToConnection = (row) => ConnectionRef.make({
|
|
3720
3682
|
id: ConnectionId.make(row.id),
|
|
3721
3683
|
scopeId: ScopeId.make(row.scope_id),
|
|
3722
3684
|
provider: row.provider,
|
|
@@ -3876,7 +3838,7 @@ var createExecutor = (config) => Effect12.gen(function* () {
|
|
|
3876
3838
|
},
|
|
3877
3839
|
forceAllowId: true
|
|
3878
3840
|
});
|
|
3879
|
-
return
|
|
3841
|
+
return ConnectionRef.make({
|
|
3880
3842
|
id: input.id,
|
|
3881
3843
|
scopeId: input.scope,
|
|
3882
3844
|
provider: input.provider,
|
|
@@ -4503,7 +4465,7 @@ var createExecutor = (config) => Effect12.gen(function* () {
|
|
|
4503
4465
|
const rows = yield* credentialBindingRowsForSlot(input);
|
|
4504
4466
|
const row = findInnermost(rows);
|
|
4505
4467
|
if (!row) {
|
|
4506
|
-
return
|
|
4468
|
+
return ResolvedCredentialSlot.make({
|
|
4507
4469
|
pluginId: input.pluginId,
|
|
4508
4470
|
sourceId: input.sourceId,
|
|
4509
4471
|
sourceScopeId: input.sourceScope,
|
|
@@ -4513,7 +4475,7 @@ var createExecutor = (config) => Effect12.gen(function* () {
|
|
|
4513
4475
|
status: "missing"
|
|
4514
4476
|
});
|
|
4515
4477
|
}
|
|
4516
|
-
return
|
|
4478
|
+
return ResolvedCredentialSlot.make({
|
|
4517
4479
|
pluginId: input.pluginId,
|
|
4518
4480
|
sourceId: input.sourceId,
|
|
4519
4481
|
sourceScopeId: input.sourceScope,
|
|
@@ -4537,7 +4499,7 @@ var createExecutor = (config) => Effect12.gen(function* () {
|
|
|
4537
4499
|
const credentialBindingRowsToUsages = (rows) => Effect12.gen(function* () {
|
|
4538
4500
|
const names = yield* sourceNamesForCredentialBindings(rows);
|
|
4539
4501
|
return rows.map(
|
|
4540
|
-
(row) =>
|
|
4502
|
+
(row) => Usage.make({
|
|
4541
4503
|
pluginId: row.plugin_id,
|
|
4542
4504
|
scopeId: ScopeId.make(
|
|
4543
4505
|
row.kind === "secret" ? row.secret_scope_id ?? row.scope_id : row.scope_id
|
|
@@ -4700,15 +4662,30 @@ var createExecutor = (config) => Effect12.gen(function* () {
|
|
|
4700
4662
|
}
|
|
4701
4663
|
const decls = plugin.staticSources ? plugin.staticSources(extension) : [];
|
|
4702
4664
|
for (const source of decls) {
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4665
|
+
const mountUnderExecutor = source.kind === "executor" && source.id === plugin.id;
|
|
4666
|
+
const mountedSource = mountUnderExecutor ? EXECUTOR_SOURCE : source;
|
|
4667
|
+
if (mountUnderExecutor) {
|
|
4668
|
+
if (!staticSources.has(EXECUTOR_SOURCE_ID)) {
|
|
4669
|
+
staticSources.set(EXECUTOR_SOURCE_ID, {
|
|
4670
|
+
source: EXECUTOR_SOURCE,
|
|
4671
|
+
pluginId: EXECUTOR_SOURCE_ID
|
|
4672
|
+
});
|
|
4673
|
+
}
|
|
4674
|
+
} else {
|
|
4675
|
+
if (staticSources.has(source.id)) {
|
|
4676
|
+
return yield* new StorageError3({
|
|
4677
|
+
message: `Duplicate static source id: ${source.id} (plugin ${plugin.id})`,
|
|
4678
|
+
cause: void 0
|
|
4679
|
+
});
|
|
4680
|
+
}
|
|
4681
|
+
staticSources.set(source.id, { source, pluginId: plugin.id });
|
|
4708
4682
|
}
|
|
4709
|
-
staticSources.set(source.id, { source, pluginId: plugin.id });
|
|
4710
4683
|
for (const tool of source.tools) {
|
|
4711
|
-
const
|
|
4684
|
+
const mountedTool = mountUnderExecutor ? {
|
|
4685
|
+
...tool,
|
|
4686
|
+
name: `${plugin.id}.${tool.name}`
|
|
4687
|
+
} : tool;
|
|
4688
|
+
const fqid = `${mountedSource.id}.${mountedTool.name}`;
|
|
4712
4689
|
if (staticTools.has(fqid)) {
|
|
4713
4690
|
return yield* new StorageError3({
|
|
4714
4691
|
message: `Duplicate static tool id: ${fqid} (plugin ${plugin.id})`,
|
|
@@ -4716,8 +4693,8 @@ var createExecutor = (config) => Effect12.gen(function* () {
|
|
|
4716
4693
|
});
|
|
4717
4694
|
}
|
|
4718
4695
|
staticTools.set(fqid, {
|
|
4719
|
-
source,
|
|
4720
|
-
tool,
|
|
4696
|
+
source: mountedSource,
|
|
4697
|
+
tool: mountedTool,
|
|
4721
4698
|
pluginId: plugin.id,
|
|
4722
4699
|
ctx
|
|
4723
4700
|
});
|
|
@@ -4904,7 +4881,7 @@ var createExecutor = (config) => Effect12.gen(function* () {
|
|
|
4904
4881
|
}
|
|
4905
4882
|
})
|
|
4906
4883
|
);
|
|
4907
|
-
return
|
|
4884
|
+
return ToolSchema.make({
|
|
4908
4885
|
id: ToolId.make(opts.toolId),
|
|
4909
4886
|
name: opts.name,
|
|
4910
4887
|
description: opts.description,
|
|
@@ -4928,8 +4905,8 @@ var createExecutor = (config) => Effect12.gen(function* () {
|
|
|
4928
4905
|
name: staticEntry.tool.name,
|
|
4929
4906
|
description: staticEntry.tool.description,
|
|
4930
4907
|
sourceId: void 0,
|
|
4931
|
-
rawInput: staticEntry.tool.inputSchema,
|
|
4932
|
-
rawOutput: staticEntry.tool.outputSchema
|
|
4908
|
+
rawInput: toToolJsonSchema(staticEntry.tool.inputSchema),
|
|
4909
|
+
rawOutput: toToolJsonSchema(staticEntry.tool.outputSchema, "output")
|
|
4933
4910
|
});
|
|
4934
4911
|
}
|
|
4935
4912
|
const rows = yield* core.findMany({
|
|
@@ -5008,7 +4985,7 @@ var createExecutor = (config) => Effect12.gen(function* () {
|
|
|
5008
4985
|
if (!policyForcesApproval && !annotations?.requiresApproval) return;
|
|
5009
4986
|
const tid = ToolId.make(toolId);
|
|
5010
4987
|
const message = annotations?.approvalDescription ? annotations.approvalDescription : policyForcesApproval && policy ? `Approve ${toolId}? (matched policy: ${policy.pattern})` : `Approve ${toolId}?`;
|
|
5011
|
-
const request =
|
|
4988
|
+
const request = FormElicitation.make({
|
|
5012
4989
|
message: `${message}
|
|
5013
4990
|
|
|
5014
4991
|
Arguments:
|
|
@@ -5407,12 +5384,11 @@ ${approvalArgumentPreview(args)}`,
|
|
|
5407
5384
|
|
|
5408
5385
|
// src/scope.ts
|
|
5409
5386
|
import { Schema as Schema15 } from "effect";
|
|
5410
|
-
var Scope =
|
|
5387
|
+
var Scope = Schema15.Struct({
|
|
5411
5388
|
id: ScopeId,
|
|
5412
5389
|
name: Schema15.String,
|
|
5413
5390
|
createdAt: Schema15.Date
|
|
5414
|
-
})
|
|
5415
|
-
};
|
|
5391
|
+
});
|
|
5416
5392
|
|
|
5417
5393
|
export {
|
|
5418
5394
|
pluginBlobStore,
|
|
@@ -5437,7 +5413,6 @@ export {
|
|
|
5437
5413
|
CredentialBindingValue,
|
|
5438
5414
|
ConfiguredCredentialBinding,
|
|
5439
5415
|
ConfiguredCredentialValue,
|
|
5440
|
-
ConfiguredCredentialValueSchema,
|
|
5441
5416
|
ScopedSecretCredentialInput,
|
|
5442
5417
|
CredentialBindingRef,
|
|
5443
5418
|
SetCredentialBindingInput,
|
|
@@ -5529,4 +5504,4 @@ export {
|
|
|
5529
5504
|
createExecutor,
|
|
5530
5505
|
Scope
|
|
5531
5506
|
};
|
|
5532
|
-
//# sourceMappingURL=chunk-
|
|
5507
|
+
//# sourceMappingURL=chunk-OIJL6F6M.js.map
|