@alistigo/artifact-core 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mikael Labrut
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/auth.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @experimental
3
+ * Placeholder for future auth plugin extension point.
4
+ * No implementation ships in P0 — typed stub for forward compatibility.
5
+ */
6
+ export interface AuthPlugin {
7
+ readonly type: "auth";
8
+ getToken(): Promise<string | undefined>;
9
+ }
10
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACzC"}
package/dist/auth.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { Component, type ErrorInfo, type ReactNode } from "react";
2
+ export interface ArtifactErrorBoundaryProps {
3
+ onError: (error: Error, componentStack: string | undefined) => void;
4
+ children?: ReactNode;
5
+ }
6
+ interface State {
7
+ hasError: boolean;
8
+ error?: Error;
9
+ }
10
+ export declare class ArtifactErrorBoundary extends Component<ArtifactErrorBoundaryProps, State> {
11
+ state: State;
12
+ static getDerivedStateFromError(error: unknown): State;
13
+ componentDidCatch(error: unknown, errorInfo: ErrorInfo): void;
14
+ render(): ReactNode;
15
+ }
16
+ export {};
17
+ //# sourceMappingURL=error-boundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-boundary.d.ts","sourceRoot":"","sources":["../src/error-boundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElE,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACpE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,UAAU,KAAK;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,qBAAa,qBAAsB,SAAQ,SAAS,CAAC,0BAA0B,EAAE,KAAK,CAAC;IAC5E,KAAK,EAAE,KAAK,CAAuB;IAE5C,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK;IAI7C,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;IAK7D,MAAM,IAAI,SAAS;CAM7B"}
@@ -0,0 +1,18 @@
1
+ import { Component } from "react";
2
+ export class ArtifactErrorBoundary extends Component {
3
+ state = { hasError: false };
4
+ static getDerivedStateFromError(error) {
5
+ return { hasError: true, error: error instanceof Error ? error : new Error(String(error)) };
6
+ }
7
+ componentDidCatch(error, errorInfo) {
8
+ const wrapped = error instanceof Error ? error : new Error(String(error));
9
+ this.props.onError(wrapped, errorInfo.componentStack ?? undefined);
10
+ }
11
+ render() {
12
+ if (this.state.hasError) {
13
+ return null;
14
+ }
15
+ return this.props.children;
16
+ }
17
+ }
18
+ //# sourceMappingURL=error-boundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-boundary.js","sourceRoot":"","sources":["../src/error-boundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkC,MAAM,OAAO,CAAC;AAYlE,MAAM,OAAO,qBAAsB,SAAQ,SAA4C;IAC5E,KAAK,GAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAE5C,MAAM,CAAC,wBAAwB,CAAC,KAAc;QAC5C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;IAC9F,CAAC;IAEQ,iBAAiB,CAAC,KAAc,EAAE,SAAoB;QAC7D,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,cAAc,IAAI,SAAS,CAAC,CAAC;IACrE,CAAC;IAEQ,MAAM;QACb,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ export type { AlistigoPlugin, PluginHostInfo, PluginLogger, PluginRuntime, } from "@alistigo/artifact-plugin-api";
2
+ export { createPluginRuntime } from "@alistigo/artifact-plugin-api";
3
+ export { createLogger } from "@alistigo/logger";
4
+ export type { AuthPlugin } from "./auth.js";
5
+ export type { ArtifactErrorBoundaryProps } from "./error-boundary.js";
6
+ export { ArtifactErrorBoundary } from "./error-boundary.js";
7
+ export type { ArtifactLifecycle, StartArtifactConfig } from "./lifecycle.js";
8
+ export { useArtifactLifecycle, useArtifactPhase, useStartArtifact } from "./lifecycle.js";
9
+ export type { ArtifactPhase } from "./phase.js";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,GACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,YAAY,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC1F,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { createPluginRuntime } from "@alistigo/artifact-plugin-api";
2
+ export { createLogger } from "@alistigo/logger";
3
+ export { ArtifactErrorBoundary } from "./error-boundary.js";
4
+ export { useArtifactLifecycle, useArtifactPhase, useStartArtifact } from "./lifecycle.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { ArtifactPhase } from "./phase.js";
2
+ export interface ArtifactLifecycle {
3
+ phase: ArtifactPhase;
4
+ error: Error | undefined;
5
+ setPhase: (phase: ArtifactPhase, error?: Error) => void;
6
+ }
7
+ export declare function useArtifactLifecycle(): ArtifactLifecycle;
8
+ export declare function useArtifactPhase(): ArtifactPhase;
9
+ export interface StartArtifactConfig {
10
+ onReady?: () => void | Promise<void>;
11
+ onError?: (error: Error) => void;
12
+ }
13
+ export declare function useStartArtifact(config: StartArtifactConfig, lifecycle: ArtifactLifecycle): void;
14
+ //# sourceMappingURL=lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../src/lifecycle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;CACzD;AAED,wBAAgB,oBAAoB,IAAI,iBAAiB,CAUxD;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAEhD;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,mBAAmB,EAAE,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAmBhG"}
@@ -0,0 +1,34 @@
1
+ import { useCallback, useEffect, useRef, useState } from "react";
2
+ export function useArtifactLifecycle() {
3
+ const [phase, setPhaseState] = useState("loading");
4
+ const [error, setError] = useState(undefined);
5
+ const setPhase = useCallback((next, err) => {
6
+ setPhaseState(next);
7
+ setError(err);
8
+ }, []);
9
+ return { phase, error, setPhase };
10
+ }
11
+ export function useArtifactPhase() {
12
+ return useArtifactLifecycle().phase;
13
+ }
14
+ export function useStartArtifact(config, lifecycle) {
15
+ const configRef = useRef(config);
16
+ configRef.current = config;
17
+ const setPhase = lifecycle.setPhase;
18
+ useEffect(() => {
19
+ // fallow-ignore-next-line complexity
20
+ const run = async () => {
21
+ try {
22
+ await configRef.current.onReady?.();
23
+ setPhase("ready");
24
+ }
25
+ catch (err) {
26
+ const error = err instanceof Error ? err : new Error(String(err));
27
+ setPhase("error", error);
28
+ configRef.current.onError?.(error);
29
+ }
30
+ };
31
+ void run();
32
+ }, [setPhase]);
33
+ }
34
+ //# sourceMappingURL=lifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../src/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AASjE,MAAM,UAAU,oBAAoB;IACl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QACF,KAAK,GAAG,EAAE,CAAC;IACb,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,CAAC"}
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@alistigo/artifact-core",
3
+ "version": "0.2.0",
4
+ "description": "Shared lifecycle, phases, error boundary, and plugin integration for Alistigo artifacts.",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "Mikael Labrut",
8
+ "email": "contact@alistigo.com"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/alistigo/holos.git",
13
+ "directory": "packages/artifact-core"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/alistigo/holos/issues"
17
+ },
18
+ "homepage": "https://github.com/alistigo/holos/tree/main/packages/artifact-core#readme",
19
+ "keywords": [
20
+ "alistigo",
21
+ "artifact",
22
+ "core",
23
+ "lifecycle",
24
+ "typescript"
25
+ ],
26
+ "private": false,
27
+ "type": "module",
28
+ "exports": {
29
+ ".": {
30
+ "import": "./dist/index.js",
31
+ "types": "./dist/index.d.ts"
32
+ }
33
+ },
34
+ "main": "./dist/index.js",
35
+ "types": "./dist/index.d.ts",
36
+ "files": [
37
+ "dist"
38
+ ],
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "dependencies": {
43
+ "@alistigo/artifact-plugin-api": "workspace:*",
44
+ "@alistigo/logger": "workspace:*"
45
+ },
46
+ "peerDependencies": {
47
+ "react": "^18.0.0 || ^19.0.0"
48
+ },
49
+ "devDependencies": {
50
+ "@types/react": "^19.2.14"
51
+ },
52
+ "module": "./index.js"
53
+ }
@@ -0,0 +1,2 @@
1
+ export type ArtifactPhase = "loading" | "ready" | "error";
2
+ //# sourceMappingURL=phase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase.d.ts","sourceRoot":"","sources":["../src/phase.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC"}
package/dist/phase.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=phase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase.js","sourceRoot":"","sources":["../src/phase.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@alistigo/artifact-core",
3
+ "version": "0.2.0",
4
+ "description": "Shared lifecycle, phases, error boundary, and plugin integration for Alistigo artifacts.",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "Mikael Labrut",
8
+ "email": "contact@alistigo.com"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/alistigo/holos.git",
13
+ "directory": "packages/artifact-core"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/alistigo/holos/issues"
17
+ },
18
+ "homepage": "https://github.com/alistigo/holos/tree/main/packages/artifact-core#readme",
19
+ "keywords": [
20
+ "alistigo",
21
+ "artifact",
22
+ "core",
23
+ "lifecycle",
24
+ "typescript"
25
+ ],
26
+ "private": false,
27
+ "type": "module",
28
+ "exports": {
29
+ ".": {
30
+ "import": "./dist/index.js",
31
+ "types": "./dist/index.d.ts"
32
+ }
33
+ },
34
+ "main": "./dist/index.js",
35
+ "types": "./dist/index.d.ts",
36
+ "files": [
37
+ "dist"
38
+ ],
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "dependencies": {
43
+ "@alistigo/artifact-plugin-api": "0.1.7",
44
+ "@alistigo/logger": "0.2.11"
45
+ },
46
+ "peerDependencies": {
47
+ "react": "^18.0.0 || ^19.0.0"
48
+ },
49
+ "devDependencies": {
50
+ "@types/react": "^19.2.14"
51
+ }
52
+ }