@apifuse/provider-sdk 2.2.0-beta.69 → 2.2.0-beta.70
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/AUTHORING.md +17 -0
- package/CHANGELOG.md +4 -0
- package/README.md +2 -0
- package/dist/cli/templates/provider/.agents/skills/health-checks-and-fail-closed/SKILL.md.tpl +7 -4
- package/dist/health-scenario.d.ts +34 -13
- package/dist/health-scenario.js +34 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lint.js +37 -1
- package/dist/provider.d.ts +11 -11
- package/dist/provider.js +6 -6
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/dist/server/runtime-diagnostics.d.ts +165 -0
- package/dist/server/runtime-diagnostics.js +360 -0
- package/dist/server/serve-implementation.js +16 -0
- package/package.json +1 -1
- package/src/cli/templates/provider/.agents/skills/health-checks-and-fail-closed/SKILL.md.tpl +7 -4
- package/src/health-scenario.ts +60 -13
- package/src/index.ts +1 -0
- package/src/lint.ts +42 -1
- package/src/provider.ts +130 -129
- package/src/server/index.ts +28 -0
- package/src/server/runtime-diagnostics.ts +522 -0
- package/src/server/serve-implementation.ts +22 -0
package/src/provider.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
AuthAbortError,
|
|
3
|
-
credentialsAuthChallenge,
|
|
4
|
-
createAuthFlowHelpers,
|
|
5
|
-
defineCredentialsAuth,
|
|
6
|
-
} from "./auth.js";
|
|
7
1
|
export type {
|
|
8
2
|
CredentialsAuthChallengeDefinition,
|
|
9
3
|
CredentialsAuthChallengeRequest,
|
|
@@ -17,68 +11,99 @@ export type {
|
|
|
17
11
|
DefineCredentialsAuthOptions,
|
|
18
12
|
DefinedCredentialsAuth,
|
|
19
13
|
} from "./auth.js";
|
|
14
|
+
export {
|
|
15
|
+
AuthAbortError,
|
|
16
|
+
createAuthFlowHelpers,
|
|
17
|
+
credentialsAuthChallenge,
|
|
18
|
+
defineCredentialsAuth,
|
|
19
|
+
} from "./auth.js";
|
|
20
20
|
export { createFormCeremony } from "./ceremonies/index.js";
|
|
21
|
+
export type { JsonPrimitive, JsonValue } from "./contract-json.js";
|
|
22
|
+
export type {
|
|
23
|
+
OperationDefinitionFor,
|
|
24
|
+
ProviderBuilder,
|
|
25
|
+
ProviderContextOf,
|
|
26
|
+
ProviderDeclaration,
|
|
27
|
+
ProviderDefinitionFor,
|
|
28
|
+
} from "./define.js";
|
|
21
29
|
export {
|
|
22
30
|
centered,
|
|
23
|
-
delayed,
|
|
24
31
|
defineHealthJourney,
|
|
25
32
|
defineOperation,
|
|
26
33
|
defineProvider,
|
|
27
34
|
defineSmsOtpMatcher,
|
|
35
|
+
delayed,
|
|
28
36
|
every,
|
|
29
37
|
} from "./define.js";
|
|
30
38
|
export type {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
ProviderCapabilityKey,
|
|
40
|
+
ProviderEngine,
|
|
41
|
+
ProviderEngineAttachmentInput,
|
|
42
|
+
ProviderEngineBindingCandidates,
|
|
43
|
+
ProviderEngineCapabilitySurface,
|
|
44
|
+
ProviderEngineMode,
|
|
45
|
+
ProviderEngineRequest,
|
|
46
|
+
ProviderEngineResidentSurface,
|
|
47
|
+
ProviderEngineSession,
|
|
48
|
+
ProviderEngineTransport,
|
|
49
|
+
} from "./engine.js";
|
|
38
50
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
51
|
+
createInProcessProviderEngine,
|
|
52
|
+
createProviderEnvironment,
|
|
53
|
+
ENGINE_OWNED_PROXY_CREDENTIAL_ENV_NAMES,
|
|
54
|
+
ENGINE_OWNED_RESOLVER_CREDENTIAL_ENV_NAMES,
|
|
55
|
+
ENGINE_OWNED_RUNTIME_ENV_NAMES,
|
|
56
|
+
ENGINE_OWNED_TELEMETRY_ENV_NAMES,
|
|
57
|
+
isEngineOwnedEnvName,
|
|
58
|
+
isEngineOwnedProxyCredentialName,
|
|
59
|
+
isEngineOwnedResolverCredentialName,
|
|
60
|
+
isEngineOwnedRuntimeEnvName,
|
|
61
|
+
isEngineOwnedTelemetryEnvName,
|
|
62
|
+
PROVIDER_CAPABILITY_KEYS,
|
|
63
|
+
PROVIDER_ENGINE_MODE_ENV,
|
|
64
|
+
PROVIDER_ENGINE_PROTOCOL_VERSION,
|
|
65
|
+
readEngineProxyCredentials,
|
|
66
|
+
} from "./engine.js";
|
|
67
|
+
export {
|
|
68
|
+
AuthError,
|
|
69
|
+
HttpRedirectError,
|
|
70
|
+
isProviderError,
|
|
71
|
+
isSessionExpiredError,
|
|
72
|
+
isTransportError,
|
|
73
|
+
ProviderEgressDeniedError,
|
|
74
|
+
ProviderEngineAuthenticationError,
|
|
75
|
+
ProviderEngineProtocolVersionError,
|
|
76
|
+
ProviderEngineUnavailableError,
|
|
77
|
+
ProviderError,
|
|
78
|
+
type ProviderErrorObservability,
|
|
79
|
+
SDKError,
|
|
80
|
+
SessionExpiredError,
|
|
81
|
+
TransportError,
|
|
82
|
+
ValidationError,
|
|
83
|
+
} from "./errors.js";
|
|
84
|
+
export * from "./handle.js";
|
|
85
|
+
export {
|
|
86
|
+
APIFUSE_HANDLE_META_KEY,
|
|
87
|
+
HANDLE_KIND_NAME_PATTERN,
|
|
88
|
+
handleFieldDescription,
|
|
89
|
+
handleFieldNameFor,
|
|
90
|
+
handleHasDirectionalFieldNames,
|
|
91
|
+
isHandleFieldMeta,
|
|
92
|
+
} from "./handle-meta.js";
|
|
69
93
|
export type {
|
|
70
94
|
AssertionExpression,
|
|
71
95
|
AssertionPredicate,
|
|
72
|
-
AttemptReference,
|
|
73
96
|
AssertResult,
|
|
74
97
|
AssertStep,
|
|
98
|
+
AttemptReference,
|
|
75
99
|
BoundedJsonPath,
|
|
76
100
|
CandidateBlock,
|
|
77
101
|
CandidatePolicy,
|
|
78
102
|
CandidateReference,
|
|
79
|
-
CredentialReference,
|
|
80
103
|
CredentialRefDeclaration,
|
|
104
|
+
CredentialReference,
|
|
81
105
|
EstablishedConnectionReference,
|
|
106
|
+
ExtractResult,
|
|
82
107
|
ExtractStep,
|
|
83
108
|
FindFirst,
|
|
84
109
|
GuardAttribution,
|
|
@@ -87,16 +112,16 @@ export type {
|
|
|
87
112
|
GuardStep,
|
|
88
113
|
HealthScenario,
|
|
89
114
|
HealthStep,
|
|
90
|
-
JsonTemplate,
|
|
91
115
|
JournalPolicy,
|
|
116
|
+
JsonTemplate,
|
|
92
117
|
ManualTriggerPolicy,
|
|
93
118
|
NonEmpty,
|
|
119
|
+
Operand,
|
|
94
120
|
OperationResult,
|
|
95
121
|
OperationStep,
|
|
96
|
-
Operand,
|
|
97
122
|
Quantifier,
|
|
98
|
-
ReferenceNode,
|
|
99
123
|
Reference,
|
|
124
|
+
ReferenceNode,
|
|
100
125
|
RelativeDateNode,
|
|
101
126
|
RetryPolicy,
|
|
102
127
|
SafeRegex,
|
|
@@ -106,70 +131,46 @@ export type {
|
|
|
106
131
|
ScopedOperand,
|
|
107
132
|
StepBase,
|
|
108
133
|
StepReference,
|
|
109
|
-
ExtractResult,
|
|
110
134
|
ValueType,
|
|
111
135
|
} from "./health-scenario.js";
|
|
112
136
|
export {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
readEngineProxyCredentials,
|
|
145
|
-
} from "./engine.js";
|
|
146
|
-
export type {
|
|
147
|
-
ProviderCapabilityKey,
|
|
148
|
-
ProviderEngine,
|
|
149
|
-
ProviderEngineAttachmentInput,
|
|
150
|
-
ProviderEngineBindingCandidates,
|
|
151
|
-
ProviderEngineCapabilitySurface,
|
|
152
|
-
ProviderEngineMode,
|
|
153
|
-
ProviderEngineRequest,
|
|
154
|
-
ProviderEngineResidentSurface,
|
|
155
|
-
ProviderEngineSession,
|
|
156
|
-
ProviderEngineTransport,
|
|
157
|
-
} from "./engine.js";
|
|
137
|
+
AssertionExpressionSchema,
|
|
138
|
+
AssertionPredicateSchema,
|
|
139
|
+
AssertStepSchema,
|
|
140
|
+
BoundedJsonPathSchema,
|
|
141
|
+
CandidateBlockSchema,
|
|
142
|
+
CandidatePolicySchema,
|
|
143
|
+
CredentialRefDeclarationSchema,
|
|
144
|
+
defineHealthScenario,
|
|
145
|
+
ExtractStepSchema,
|
|
146
|
+
FindFirstSchema,
|
|
147
|
+
GUARD_REASON_CODES,
|
|
148
|
+
GuardStepSchema,
|
|
149
|
+
HealthScenarioSchema,
|
|
150
|
+
HealthStepSchema,
|
|
151
|
+
JournalPolicySchema,
|
|
152
|
+
JsonTemplateSchema,
|
|
153
|
+
ManualTriggerPolicySchema,
|
|
154
|
+
OperandSchema,
|
|
155
|
+
OperationStepSchema,
|
|
156
|
+
QuantifierSchema,
|
|
157
|
+
ReferenceSchema,
|
|
158
|
+
RelativeDateNodeSchema,
|
|
159
|
+
RetryPolicySchema,
|
|
160
|
+
SafeRegexSchema,
|
|
161
|
+
ScopedAssertionExpressionSchema,
|
|
162
|
+
ScopedAssertionPredicateSchema,
|
|
163
|
+
ScopedItemReferenceSchema,
|
|
164
|
+
ScopedOperandSchema,
|
|
165
|
+
StepReferenceSchema,
|
|
166
|
+
ValueTypeSchema,
|
|
167
|
+
} from "./health-scenario.js";
|
|
158
168
|
export {
|
|
159
169
|
getProviderLocalePath,
|
|
160
170
|
type ProviderErrorMessageParams,
|
|
161
171
|
providerLocaleKey,
|
|
162
172
|
qualifyProviderLocaleKey,
|
|
163
173
|
} from "./i18n/index.js";
|
|
164
|
-
export * from "./handle.js";
|
|
165
|
-
export {
|
|
166
|
-
APIFUSE_HANDLE_META_KEY,
|
|
167
|
-
HANDLE_KIND_NAME_PATTERN,
|
|
168
|
-
handleFieldDescription,
|
|
169
|
-
handleFieldNameFor,
|
|
170
|
-
handleHasDirectionalFieldNames,
|
|
171
|
-
isHandleFieldMeta,
|
|
172
|
-
} from "./handle-meta.js";
|
|
173
174
|
export {
|
|
174
175
|
type CreateHandleContextOptions,
|
|
175
176
|
type CreateTestHandleContextOptions,
|
|
@@ -179,6 +180,25 @@ export {
|
|
|
179
180
|
type NormalizedHandle,
|
|
180
181
|
normalizeHandle,
|
|
181
182
|
} from "./runtime/handle.js";
|
|
183
|
+
export type {
|
|
184
|
+
NativeGatewayProxy,
|
|
185
|
+
NativeGatewayProxyResolutionInput,
|
|
186
|
+
NativeGatewayProxySkipReason,
|
|
187
|
+
NativeGatewayProxySynthesisInput,
|
|
188
|
+
NativeGatewayProxySynthesisResult,
|
|
189
|
+
NativeGatewayProxySynthesizer,
|
|
190
|
+
NativeNetworkClientOptions,
|
|
191
|
+
NativeNetworkErrorCode,
|
|
192
|
+
VendorCredentialLookup,
|
|
193
|
+
VendorCredentialResolver,
|
|
194
|
+
} from "./runtime/native-network.js";
|
|
195
|
+
export {
|
|
196
|
+
NativeEgressGrantExpiredError,
|
|
197
|
+
NativeEgressNotDeclaredError,
|
|
198
|
+
NativeIdleTimeoutError,
|
|
199
|
+
NativeNetworkError,
|
|
200
|
+
NativeProxyExpiredError,
|
|
201
|
+
} from "./runtime/native-network-errors.js";
|
|
182
202
|
export {
|
|
183
203
|
createMemoryProviderRuntimeState,
|
|
184
204
|
createUnsupportedProviderRuntimeState,
|
|
@@ -233,8 +253,8 @@ export type {
|
|
|
233
253
|
NativeContext,
|
|
234
254
|
NativeNetworkClient,
|
|
235
255
|
NativeNetworkCloseReason,
|
|
236
|
-
NativeNetworkConnection,
|
|
237
256
|
NativeNetworkConnectInput,
|
|
257
|
+
NativeNetworkConnection,
|
|
238
258
|
NativeNetworkConnectOptions,
|
|
239
259
|
NativeNetworkDynamicGrantOptions,
|
|
240
260
|
NativeNetworkEgressGrant,
|
|
@@ -252,9 +272,8 @@ export type {
|
|
|
252
272
|
OperationApprovalPolicy,
|
|
253
273
|
OperationContractMetadata,
|
|
254
274
|
OperationDefinition,
|
|
255
|
-
OperationExample,
|
|
256
275
|
OperationErrorCode,
|
|
257
|
-
|
|
276
|
+
OperationExample,
|
|
258
277
|
OperationLifecycle,
|
|
259
278
|
OperationObservabilityConfig,
|
|
260
279
|
OperationObservabilitySensitiveConfig,
|
|
@@ -267,6 +286,7 @@ export type {
|
|
|
267
286
|
ProviderContextFor,
|
|
268
287
|
ProviderDefinition,
|
|
269
288
|
ProviderDeploymentOverrides,
|
|
289
|
+
ProviderErrorStatus,
|
|
270
290
|
ProviderFileRef,
|
|
271
291
|
ProviderFilesContext,
|
|
272
292
|
ProviderLocale,
|
|
@@ -274,16 +294,16 @@ export type {
|
|
|
274
294
|
ProviderLocaleKeyInput,
|
|
275
295
|
ProviderLogoProfile,
|
|
276
296
|
ProviderProxyPolicy,
|
|
277
|
-
ProxiedOAuthConfig,
|
|
278
297
|
ProviderPublicConnectionMode,
|
|
279
298
|
ProviderPublicProfile,
|
|
280
299
|
ProviderResolvedFile,
|
|
281
|
-
ProviderRuntimeTarget,
|
|
282
300
|
ProviderRuntimeState,
|
|
283
|
-
|
|
301
|
+
ProviderRuntimeTarget,
|
|
284
302
|
ProviderStateDurationString,
|
|
285
303
|
ProviderStateNamespace,
|
|
304
|
+
ProviderStealthConfig,
|
|
286
305
|
ProviderSupportLevel,
|
|
306
|
+
ProxiedOAuthConfig,
|
|
287
307
|
RedirectRunReason,
|
|
288
308
|
SchemaLike,
|
|
289
309
|
SmsOtpMatcherDefinition,
|
|
@@ -295,25 +315,6 @@ export type {
|
|
|
295
315
|
StateWriteOptions,
|
|
296
316
|
StealthChallengeClassification,
|
|
297
317
|
} from "./types.js";
|
|
298
|
-
export {
|
|
299
|
-
NativeEgressGrantExpiredError,
|
|
300
|
-
NativeEgressNotDeclaredError,
|
|
301
|
-
NativeIdleTimeoutError,
|
|
302
|
-
NativeNetworkError,
|
|
303
|
-
NativeProxyExpiredError,
|
|
304
|
-
} from "./runtime/native-network-errors.js";
|
|
305
|
-
export type {
|
|
306
|
-
NativeGatewayProxy,
|
|
307
|
-
NativeGatewayProxyResolutionInput,
|
|
308
|
-
NativeGatewayProxySkipReason,
|
|
309
|
-
NativeGatewayProxySynthesizer,
|
|
310
|
-
NativeGatewayProxySynthesisResult,
|
|
311
|
-
NativeGatewayProxySynthesisInput,
|
|
312
|
-
NativeNetworkClientOptions,
|
|
313
|
-
NativeNetworkErrorCode,
|
|
314
|
-
VendorCredentialLookup,
|
|
315
|
-
VendorCredentialResolver,
|
|
316
|
-
} from "./runtime/native-network.js";
|
|
317
318
|
export {
|
|
318
319
|
HttpRetryAfterPolicy,
|
|
319
320
|
HttpRetryDelayStrategy,
|
package/src/server/index.ts
CHANGED
|
@@ -154,6 +154,34 @@ export {
|
|
|
154
154
|
SELF_TEST_MAX_TEXT_LENGTH,
|
|
155
155
|
SELF_TEST_REDACTED_PLACEHOLDER,
|
|
156
156
|
} from "./self-test-redaction.js";
|
|
157
|
+
export {
|
|
158
|
+
type CollectRuntimeDiagnosticsInput,
|
|
159
|
+
collectRuntimeDiagnostics,
|
|
160
|
+
DEFAULT_PROCFS_SELF_ROOT,
|
|
161
|
+
DEFAULT_RUNTIME_DIAGNOSTICS_WINDOW_MS,
|
|
162
|
+
MAX_RUNTIME_DIAGNOSTICS_WINDOW_MS,
|
|
163
|
+
MIN_RUNTIME_DIAGNOSTICS_WINDOW_MS,
|
|
164
|
+
normalizeRuntimeDiagnosticsWindowMs,
|
|
165
|
+
PROCFS_CLOCK_TICKS_PER_SECOND,
|
|
166
|
+
resolveRuntimeDiagnosticsWindowMs,
|
|
167
|
+
RUNTIME_DIAGNOSTICS_ROUTE,
|
|
168
|
+
RUNTIME_DIAGNOSTICS_SCHEMA_VERSION,
|
|
169
|
+
RUNTIME_DIAGNOSTICS_WINDOW_QUERY,
|
|
170
|
+
type RuntimeDiagnosticsActiveResources,
|
|
171
|
+
type RuntimeDiagnosticsClock,
|
|
172
|
+
type RuntimeDiagnosticsCpu,
|
|
173
|
+
type RuntimeDiagnosticsCpuTotals,
|
|
174
|
+
type RuntimeDiagnosticsEventLoop,
|
|
175
|
+
type RuntimeDiagnosticsEventLoopUtilization,
|
|
176
|
+
type RuntimeDiagnosticsFdKind,
|
|
177
|
+
type RuntimeDiagnosticsMemory,
|
|
178
|
+
type RuntimeDiagnosticsProcfs,
|
|
179
|
+
type RuntimeDiagnosticsReport,
|
|
180
|
+
type RuntimeDiagnosticsThread,
|
|
181
|
+
type RuntimeDiagnosticsThreadContextSwitches,
|
|
182
|
+
type RuntimeDiagnosticsThreadCpuTicks,
|
|
183
|
+
type RuntimeDiagnosticsThreadWindow,
|
|
184
|
+
} from "./runtime-diagnostics.js";
|
|
157
185
|
export {
|
|
158
186
|
DEFAULT_SELF_TEST_PORT,
|
|
159
187
|
deriveSelfTestToken,
|