@xrkseek/harness 0.4.8 → 0.4.9
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/node_modules/@xrkseek/cordis/LICENSE +21 -0
- package/node_modules/@xrkseek/cordis/README.md +14 -0
- package/node_modules/@xrkseek/cordis/bin.js +16 -0
- package/node_modules/@xrkseek/cordis/lib/index.js +1828 -0
- package/node_modules/@xrkseek/cordis/lib/types/context.d.ts +101 -0
- package/node_modules/@xrkseek/cordis/lib/types/context.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/lib/types/events.d.ts +240 -0
- package/node_modules/@xrkseek/cordis/lib/types/events.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/lib/types/fiber.d.ts +202 -0
- package/node_modules/@xrkseek/cordis/lib/types/fiber.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/lib/types/index.d.ts +15 -0
- package/node_modules/@xrkseek/cordis/lib/types/index.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/lib/types/logger.d.ts +105 -0
- package/node_modules/@xrkseek/cordis/lib/types/logger.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/lib/types/reflect.d.ts +186 -0
- package/node_modules/@xrkseek/cordis/lib/types/reflect.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/lib/types/registry.d.ts +201 -0
- package/node_modules/@xrkseek/cordis/lib/types/registry.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/lib/types/service.d.ts +55 -0
- package/node_modules/@xrkseek/cordis/lib/types/service.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/lib/types/utils.d.ts +62 -0
- package/node_modules/@xrkseek/cordis/lib/types/utils.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/package.json +49 -0
- package/node_modules/@xrkseek/cordis/src/context.d.ts +101 -0
- package/node_modules/@xrkseek/cordis/src/context.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/src/context.js +99 -0
- package/node_modules/@xrkseek/cordis/src/context.js.map +1 -0
- package/node_modules/@xrkseek/cordis/src/context.ts +146 -0
- package/node_modules/@xrkseek/cordis/src/events.d.ts +240 -0
- package/node_modules/@xrkseek/cordis/src/events.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/src/events.js +199 -0
- package/node_modules/@xrkseek/cordis/src/events.js.map +1 -0
- package/node_modules/@xrkseek/cordis/src/events.ts +352 -0
- package/node_modules/@xrkseek/cordis/src/fiber.d.ts +202 -0
- package/node_modules/@xrkseek/cordis/src/fiber.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/src/fiber.js +677 -0
- package/node_modules/@xrkseek/cordis/src/fiber.js.map +1 -0
- package/node_modules/@xrkseek/cordis/src/fiber.ts +754 -0
- package/node_modules/@xrkseek/cordis/src/index.d.ts +15 -0
- package/node_modules/@xrkseek/cordis/src/index.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/src/index.js +15 -0
- package/node_modules/@xrkseek/cordis/src/index.js.map +1 -0
- package/node_modules/@xrkseek/cordis/src/index.ts +14 -0
- package/node_modules/@xrkseek/cordis/src/logger.d.ts +105 -0
- package/node_modules/@xrkseek/cordis/src/logger.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/src/logger.js +193 -0
- package/node_modules/@xrkseek/cordis/src/logger.js.map +1 -0
- package/node_modules/@xrkseek/cordis/src/logger.ts +270 -0
- package/node_modules/@xrkseek/cordis/src/reflect.d.ts +186 -0
- package/node_modules/@xrkseek/cordis/src/reflect.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/src/reflect.js +311 -0
- package/node_modules/@xrkseek/cordis/src/reflect.js.map +1 -0
- package/node_modules/@xrkseek/cordis/src/reflect.ts +418 -0
- package/node_modules/@xrkseek/cordis/src/registry.d.ts +201 -0
- package/node_modules/@xrkseek/cordis/src/registry.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/src/registry.js +218 -0
- package/node_modules/@xrkseek/cordis/src/registry.js.map +1 -0
- package/node_modules/@xrkseek/cordis/src/registry.ts +337 -0
- package/node_modules/@xrkseek/cordis/src/service.d.ts +55 -0
- package/node_modules/@xrkseek/cordis/src/service.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/src/service.js +113 -0
- package/node_modules/@xrkseek/cordis/src/service.js.map +1 -0
- package/node_modules/@xrkseek/cordis/src/service.ts +115 -0
- package/node_modules/@xrkseek/cordis/src/utils.d.ts +62 -0
- package/node_modules/@xrkseek/cordis/src/utils.d.ts.map +1 -0
- package/node_modules/@xrkseek/cordis/src/utils.js +271 -0
- package/node_modules/@xrkseek/cordis/src/utils.js.map +1 -0
- package/node_modules/@xrkseek/cordis/src/utils.ts +287 -0
- package/node_modules/@xrkseek/core-agent-loop/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-agent-loop/dist/index.js +39 -68
- package/node_modules/@xrkseek/core-agent-loop/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/compaction.d.ts +4 -3
- package/node_modules/@xrkseek/core-session/dist/compaction.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/compaction.js.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/subagent-prompt.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/subagent-prompt.js +2 -1
- package/node_modules/@xrkseek/core-tools/dist/subagent-prompt.js.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/README.md +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/catalog.d.ts +16 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/catalog.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/catalog.js +152 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/catalog.js.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/deepinfra-http.d.ts +9 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/deepinfra-http.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/deepinfra-http.js +21 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/deepinfra-http.js.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/fal-http.d.ts +16 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/fal-http.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/fal-http.js +189 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/fal-http.js.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/index.d.ts +10 -5
- package/node_modules/@xrkseek/exec-image-gen/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/index.js +174 -18
- package/node_modules/@xrkseek/exec-image-gen/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/krea-http.d.ts +16 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/krea-http.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/krea-http.js +144 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/krea-http.js.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/meta-ai-http.d.ts +9 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/meta-ai-http.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/meta-ai-http.js +21 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/meta-ai-http.js.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/openai-http.d.ts +4 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/openai-http.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/openai-http.js +7 -5
- package/node_modules/@xrkseek/exec-image-gen/dist/openai-http.js.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/openrouter-http.d.ts +14 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/openrouter-http.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/openrouter-http.js +117 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/openrouter-http.js.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/tools.js +43 -6
- package/node_modules/@xrkseek/exec-image-gen/dist/tools.js.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/types.d.ts +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/types.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/types.js.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/xai-http.d.ts +16 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/xai-http.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/xai-http.js +137 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/xai-http.js.map +1 -0
- package/node_modules/@xrkseek/exec-memory/dist/consolidate-pipeline.d.ts +52 -0
- package/node_modules/@xrkseek/exec-memory/dist/consolidate-pipeline.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-memory/dist/consolidate-pipeline.js +216 -0
- package/node_modules/@xrkseek/exec-memory/dist/consolidate-pipeline.js.map +1 -0
- package/node_modules/@xrkseek/exec-memory/dist/index.d.ts +1 -0
- package/node_modules/@xrkseek/exec-memory/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/index.js +1 -0
- package/node_modules/@xrkseek/exec-memory/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/tools.js +20 -7
- package/node_modules/@xrkseek/exec-memory/dist/tools.js.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/README.md +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/catalog.d.ts +14 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/catalog.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/catalog.js +99 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/catalog.js.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/deepinfra-http.d.ts +9 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/deepinfra-http.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/deepinfra-http.js +17 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/deepinfra-http.js.map +1 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/fal-http.d.ts +14 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/fal-http.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/fal-http.js +342 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/fal-http.js.map +1 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/index.d.ts +8 -6
- package/node_modules/@xrkseek/exec-video-gen/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/index.js +122 -19
- package/node_modules/@xrkseek/exec-video-gen/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/openai-http.d.ts +4 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/openai-http.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/openai-http.js +21 -15
- package/node_modules/@xrkseek/exec-video-gen/dist/openai-http.js.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/openrouter-http.d.ts +9 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/openrouter-http.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/openrouter-http.js +18 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/openrouter-http.js.map +1 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/tools.js +26 -6
- package/node_modules/@xrkseek/exec-video-gen/dist/tools.js.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/types.d.ts +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/types.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/types.js.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/xai-http.d.ts +18 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/xai-http.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/xai-http.js +263 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/xai-http.js.map +1 -0
- package/node_modules/@xrkseek/preset-harness/dist/preset.d.ts.map +1 -1
- package/node_modules/@xrkseek/preset-harness/dist/preset.js +12 -3
- package/node_modules/@xrkseek/preset-harness/dist/preset.js.map +1 -1
- package/node_modules/@xrkseek/preset-harness/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/preset-minimal/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/preset-server/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/server-face/dist/agent-team-graph.d.ts +31 -0
- package/node_modules/@xrkseek/server-face/dist/agent-team-graph.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/agent-team-graph.js +125 -1
- package/node_modules/@xrkseek/server-face/dist/agent-team-graph.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/context.d.ts +19 -1
- package/node_modules/@xrkseek/server-face/dist/context.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/index.d.ts +3 -3
- package/node_modules/@xrkseek/server-face/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/index.js +1 -1
- package/node_modules/@xrkseek/server-face/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/mcp-oauth.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/mcp-oauth.js +25 -3
- package/node_modules/@xrkseek/server-face/dist/mcp-oauth.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/ralph-tool.d.ts +2 -0
- package/node_modules/@xrkseek/server-face/dist/ralph-tool.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/ralph-tool.js +11 -5
- package/node_modules/@xrkseek/server-face/dist/ralph-tool.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/runtime.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/runtime.js +1 -0
- package/node_modules/@xrkseek/server-face/dist/runtime.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-status.d.ts +16 -0
- package/node_modules/@xrkseek/server-face/dist/session-status.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-status.js +44 -5
- package/node_modules/@xrkseek/server-face/dist/session-status.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-credentials.d.ts +9 -0
- package/node_modules/@xrkseek/server-face/dist/settings-credentials.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-credentials.js +50 -0
- package/node_modules/@xrkseek/server-face/dist/settings-credentials.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-document.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-document.js +40 -0
- package/node_modules/@xrkseek/server-face/dist/settings-document.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.js +20 -4
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/subagent-tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/subagent-tools.js +191 -0
- package/node_modules/@xrkseek/server-face/dist/subagent-tools.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/wire/rpc-error.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/wire/rpc-error.js +8 -0
- package/node_modules/@xrkseek/server-face/dist/wire/rpc-error.js.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/index.js +135 -24
- package/node_modules/@xrkseek/server-host/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/sidebar-face-bridge.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/sidebar-face-bridge.js +6 -0
- package/node_modules/@xrkseek/server-host/dist/sidebar-face-bridge.js.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/workflow-engine-mount.d.ts +32 -0
- package/node_modules/@xrkseek/server-host/dist/workflow-engine-mount.d.ts.map +1 -0
- package/node_modules/@xrkseek/server-host/dist/workflow-engine-mount.js +134 -0
- package/node_modules/@xrkseek/server-host/dist/workflow-engine-mount.js.map +1 -0
- package/node_modules/@xrkseek/server-host/package.json +2 -0
- package/node_modules/@xrkseek/server-http/dist/sidebar/sidebar-adapter.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/sidebar/sidebar-adapter.js +20 -0
- package/node_modules/@xrkseek/server-http/dist/sidebar/sidebar-adapter.js.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/sidebar/sidebar-face-bridge.d.ts +10 -2
- package/node_modules/@xrkseek/server-http/dist/sidebar/sidebar-face-bridge.d.ts.map +1 -1
- package/node_modules/@xrkseek/xrk-workflow/README.i18n.yaml +6 -0
- package/node_modules/@xrkseek/xrk-workflow/README.md +73 -0
- package/node_modules/@xrkseek/xrk-workflow/README.zh.md +72 -0
- package/node_modules/@xrkseek/xrk-workflow/lib/types/index.d.ts +177 -0
- package/node_modules/@xrkseek/xrk-workflow/lib/types/index.js +730 -0
- package/node_modules/@xrkseek/xrk-workflow/lib/types/invariant.d.ts +13 -0
- package/node_modules/@xrkseek/xrk-workflow/lib/types/invariant.js +118 -0
- package/node_modules/@xrkseek/xrk-workflow/lib/types/runtime-types.d.ts +45 -0
- package/node_modules/@xrkseek/xrk-workflow/lib/types/runtime-types.js +9 -0
- package/node_modules/@xrkseek/xrk-workflow/lib/types/types.d.ts +118 -0
- package/node_modules/@xrkseek/xrk-workflow/lib/types/types.js +16 -0
- package/node_modules/@xrkseek/xrk-workflow/package.json +53 -0
- package/node_modules/@xrkseek/xrk-workflow/src/index.ts +947 -0
- package/package.json +5 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import type { Awaitable, Dict } from '@xrkseek/cosmokit';
|
|
2
|
+
import { Context } from './context.ts';
|
|
3
|
+
import type { Plugin } from './registry.ts';
|
|
4
|
+
import { DisposableList } from './utils.ts';
|
|
5
|
+
import type { Impl } from './reflect.ts';
|
|
6
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
7
|
+
declare module './context.ts' {
|
|
8
|
+
interface Context extends Pick<Fiber, 'effect'> {
|
|
9
|
+
/** The fiber (plugin runtime instance) that owns this context. */
|
|
10
|
+
fiber: Fiber;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** Error raised when plugin configuration fails standard-schema validation. */
|
|
14
|
+
export declare class ValidationError extends TypeError {
|
|
15
|
+
name: string;
|
|
16
|
+
/**
|
|
17
|
+
* Build the aggregated message from schema issues.
|
|
18
|
+
*
|
|
19
|
+
* @param issues — the standard-schema issues, one message line each.
|
|
20
|
+
*/
|
|
21
|
+
constructor(issues: readonly StandardSchemaV1.Issue[]);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Validate and normalize config for a plugin runtime before it starts.
|
|
25
|
+
*
|
|
26
|
+
* @param runtime — the plugin runtime whose `Config` schema to apply.
|
|
27
|
+
* @param config — the raw user config.
|
|
28
|
+
* @returns the validated config, or `config` unchanged if the runtime has no schema.
|
|
29
|
+
* @throws {ValidationError} when validation reports issues.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveConfig(runtime: Plugin.Runtime, config: any): any;
|
|
32
|
+
interface AsyncDisposable<T extends Awaitable<void> = Awaitable<void>> extends PromiseLike<() => T> {
|
|
33
|
+
(): T;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Function returned by an effect to release resources during disposal.
|
|
37
|
+
*
|
|
38
|
+
* Disposers run in reverse registration order when the owning fiber unloads;
|
|
39
|
+
* they may be async, in which case unloading awaits them.
|
|
40
|
+
*/
|
|
41
|
+
export type Disposable<T = any> = () => T;
|
|
42
|
+
/**
|
|
43
|
+
* Effect body result accepted by `ctx.effect()` and plugin startup.
|
|
44
|
+
*
|
|
45
|
+
* Either a single disposer, a promise of one, or a (possibly async) iterable
|
|
46
|
+
* yielding several — generator effects register each yielded disposer as it
|
|
47
|
+
* is produced.
|
|
48
|
+
*/
|
|
49
|
+
export type Effect<T = any> = SyncEffect<T> | AsyncEffect<T>;
|
|
50
|
+
type SyncEffect<T = any> = Disposable<T> | Iterable<Disposable<T>, void, void>;
|
|
51
|
+
type AsyncEffect<T = any> = Promise<Disposable<T>> | AsyncIterable<Disposable<T>, void, void>;
|
|
52
|
+
/** Tree node used to expose nested effect labels for diagnostics. */
|
|
53
|
+
export interface EffectMeta {
|
|
54
|
+
/** Human-readable effect label, e.g. `ctx.on("event")` or `ctx.provide("name")`. */
|
|
55
|
+
label: string;
|
|
56
|
+
/** Metadata of nested effects registered while this effect ran. */
|
|
57
|
+
children: EffectMeta[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Lifecycle state for one plugin fiber.
|
|
61
|
+
*
|
|
62
|
+
* `PENDING` — waiting for required services; `LOADING` — the plugin callback
|
|
63
|
+
* is running; `ACTIVE` — loaded and providing; `FAILED` — the callback or its
|
|
64
|
+
* config threw; `UNLOADING` — disposers are running; `DISPOSED` — the fiber
|
|
65
|
+
* was removed and cannot restart.
|
|
66
|
+
*/
|
|
67
|
+
export declare const enum FiberState {
|
|
68
|
+
PENDING = 0,
|
|
69
|
+
LOADING = 1,
|
|
70
|
+
ACTIVE = 2,
|
|
71
|
+
FAILED = 3,
|
|
72
|
+
DISPOSED = 4,
|
|
73
|
+
UNLOADING = 5
|
|
74
|
+
}
|
|
75
|
+
/** Framework error with a stable machine-readable code. */
|
|
76
|
+
export declare class CordisError extends Error {
|
|
77
|
+
code: CordisError.Code;
|
|
78
|
+
/**
|
|
79
|
+
* @param code — the stable error code; also the default message.
|
|
80
|
+
* @param message — optional human-readable override.
|
|
81
|
+
*/
|
|
82
|
+
constructor(code: CordisError.Code, message?: string);
|
|
83
|
+
}
|
|
84
|
+
/** Cordis error code definitions. */
|
|
85
|
+
export declare namespace CordisError {
|
|
86
|
+
type Code = keyof typeof Code;
|
|
87
|
+
const Code: {
|
|
88
|
+
readonly INACTIVE_EFFECT: "cannot create effect on inactive context";
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Runtime instance of one plugin application.
|
|
93
|
+
*
|
|
94
|
+
* A fiber tracks dependency state, validated config, lifecycle effects, and
|
|
95
|
+
* cleanup for the plugin context returned by `ctx.plugin()`.
|
|
96
|
+
*/
|
|
97
|
+
export declare class Fiber {
|
|
98
|
+
parent: Context;
|
|
99
|
+
inject: Dict<any>;
|
|
100
|
+
runtime: Plugin.Runtime | null;
|
|
101
|
+
/** Unique id within the registry; 0 for the root fiber, `null` once disposed. */
|
|
102
|
+
uid: number | null;
|
|
103
|
+
/** The context this fiber's plugin runs in (extends the parent context). */
|
|
104
|
+
readonly ctx: Context;
|
|
105
|
+
/** The validated plugin config (updated by `update()`). */
|
|
106
|
+
config: any;
|
|
107
|
+
/** The raw plugin config, re-resolved before each activation. */
|
|
108
|
+
_config: any;
|
|
109
|
+
/** Current lifecycle state; transitions emit `internal/status`. */
|
|
110
|
+
state: FiberState;
|
|
111
|
+
/** Dispose this fiber: unload the plugin, then settle once cleanup finished. */
|
|
112
|
+
readonly dispose: () => Promise<void>;
|
|
113
|
+
/** Snapshot of required service implementations while loaded; `undefined` otherwise. */
|
|
114
|
+
store: Dict<Impl> | undefined;
|
|
115
|
+
/** The in-flight load/unload transition, if one is currently running. */
|
|
116
|
+
inertia: Promise<void> | undefined;
|
|
117
|
+
readonly _hooks: Dict<DisposableList<Function>>;
|
|
118
|
+
readonly _disposables: DisposableList<Disposable<any>>;
|
|
119
|
+
protected context: Context;
|
|
120
|
+
private _error;
|
|
121
|
+
private _runner;
|
|
122
|
+
private _store;
|
|
123
|
+
/**
|
|
124
|
+
* Create a fiber. Plugin authors normally obtain fibers from `ctx.plugin()`
|
|
125
|
+
* rather than constructing them directly.
|
|
126
|
+
*
|
|
127
|
+
* @param parent — the context the plugin was loaded from.
|
|
128
|
+
* @param config — raw config, validated against the runtime's schema.
|
|
129
|
+
* @param inject — resolved dependency map (service name → intercept config).
|
|
130
|
+
* @param runtime — the shared plugin runtime, or `null` for the root fiber.
|
|
131
|
+
* @param getOuterStack — captures the caller stack for effect diagnostics.
|
|
132
|
+
*/
|
|
133
|
+
constructor(parent: Context, config: any, inject: Dict<any>, runtime: Plugin.Runtime | null, getOuterStack: () => string[]);
|
|
134
|
+
/** The plugin's display name, inherited from the nearest named ancestor, else `'root'`. */
|
|
135
|
+
get name(): string;
|
|
136
|
+
/**
|
|
137
|
+
* Throw if the fiber has already been disposed.
|
|
138
|
+
*
|
|
139
|
+
* @returns nothing when the fiber is still active.
|
|
140
|
+
* @throws {CordisError} `INACTIVE_EFFECT` when the fiber's uid has been cleared.
|
|
141
|
+
*/
|
|
142
|
+
assertActive(): void;
|
|
143
|
+
private _execute;
|
|
144
|
+
/**
|
|
145
|
+
* Register a cleanup-aware effect on this fiber.
|
|
146
|
+
*
|
|
147
|
+
* `execute` runs immediately; the disposers it produces are collected and
|
|
148
|
+
* run (in reverse order) either when the returned disposer is called or
|
|
149
|
+
* when the fiber unloads, whichever comes first. Calling the disposer twice
|
|
150
|
+
* is a no-op. Throws `CordisError('INACTIVE_EFFECT')` if the fiber is
|
|
151
|
+
* already disposed, and `TypeError` if `execute` returns an invalid shape.
|
|
152
|
+
*
|
|
153
|
+
* @param execute — the effect body; see {@link Effect} for accepted shapes.
|
|
154
|
+
* @param label — effect label shown in `getEffects()` diagnostics.
|
|
155
|
+
* @returns a disposer that tears the effect down and settles once done.
|
|
156
|
+
*/
|
|
157
|
+
effect(execute: () => SyncEffect, label?: string): Disposable<Promise<void>>;
|
|
158
|
+
/** Same as above for async effects; the disposer is also awaitable. */
|
|
159
|
+
effect(execute: () => Effect, label?: string): AsyncDisposable<Promise<void>>;
|
|
160
|
+
/**
|
|
161
|
+
* Return metadata for currently registered effects.
|
|
162
|
+
*
|
|
163
|
+
* @returns one {@link EffectMeta} tree per labeled live effect.
|
|
164
|
+
*/
|
|
165
|
+
getEffects(): EffectMeta[];
|
|
166
|
+
private _getState;
|
|
167
|
+
private _updateState;
|
|
168
|
+
_checkImpl(name: string): boolean | undefined;
|
|
169
|
+
_refresh(): void;
|
|
170
|
+
private _setEpoch;
|
|
171
|
+
private _resolveConfig;
|
|
172
|
+
private _reload;
|
|
173
|
+
private _unload;
|
|
174
|
+
/**
|
|
175
|
+
* Wait for current lifecycle work and rethrow startup errors.
|
|
176
|
+
*
|
|
177
|
+
* @returns this fiber, once it has settled into a stable state.
|
|
178
|
+
* @throws the config-validation or plugin-startup error, if any.
|
|
179
|
+
*/
|
|
180
|
+
await(): Promise<this>;
|
|
181
|
+
/**
|
|
182
|
+
* Dispose and immediately reload this plugin with its current config.
|
|
183
|
+
*
|
|
184
|
+
* @returns a promise resolving once the reload settled.
|
|
185
|
+
* @throws {CordisError} `INACTIVE_EFFECT` when the fiber is already disposed.
|
|
186
|
+
*/
|
|
187
|
+
restart(): Promise<void>;
|
|
188
|
+
/**
|
|
189
|
+
* Validate and apply new config, then restart the plugin.
|
|
190
|
+
*
|
|
191
|
+
* Runs the `internal/update` waterfall first, so update hooks (and HMR)
|
|
192
|
+
* can veto or replace the restart.
|
|
193
|
+
*
|
|
194
|
+
* @param config — the new raw config; validated before anything restarts.
|
|
195
|
+
* @param noSave — hint for persistence hooks not to write the change back.
|
|
196
|
+
* @returns the update waterfall result; the default restart returns a promise.
|
|
197
|
+
* @throws when validation, an update listener, or the restarted plugin fails.
|
|
198
|
+
*/
|
|
199
|
+
update(config: any, noSave?: boolean): void | Promise<void>;
|
|
200
|
+
}
|
|
201
|
+
export {};
|
|
202
|
+
//# sourceMappingURL=fiber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fiber.d.ts","sourceRoot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