@plico-ai/runtime 0.0.0-reserved.0 → 0.1.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/NOTICE +4 -0
- package/README.md +9 -3
- package/dist/artifacts.d.ts +10 -0
- package/dist/artifacts.js +106 -0
- package/dist/engine/context.d.ts +16 -0
- package/dist/engine/context.js +77 -0
- package/dist/engine/engine.d.ts +12 -0
- package/dist/engine/engine.js +235 -0
- package/dist/engine/errors.d.ts +12 -0
- package/dist/engine/errors.js +19 -0
- package/dist/engine/index.d.ts +7 -0
- package/dist/engine/index.js +5 -0
- package/dist/engine/journal.d.ts +65 -0
- package/dist/engine/journal.js +1 -0
- package/dist/engine/memory-journal.d.ts +2 -0
- package/dist/engine/memory-journal.js +125 -0
- package/dist/engine/sqlite-engine.d.ts +7 -0
- package/dist/engine/sqlite-engine.js +6 -0
- package/dist/engine/sqlite-journal.d.ts +5 -0
- package/dist/engine/sqlite-journal.js +136 -0
- package/dist/engine/types.d.ts +97 -0
- package/dist/engine/types.js +1 -0
- package/dist/env.d.ts +7 -0
- package/dist/env.js +19 -0
- package/dist/errors.d.ts +18 -0
- package/dist/errors.js +40 -0
- package/dist/evals/discover.d.ts +3 -0
- package/dist/evals/discover.js +49 -0
- package/dist/evals/index.d.ts +3 -0
- package/dist/evals/index.js +3 -0
- package/dist/evals/promote.d.ts +7 -0
- package/dist/evals/promote.js +32 -0
- package/dist/evals/run-evals.d.ts +2 -0
- package/dist/evals/run-evals.js +69 -0
- package/dist/events.d.ts +28 -0
- package/dist/events.js +104 -0
- package/dist/guards.d.ts +1 -0
- package/dist/guards.js +3 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +17 -0
- package/dist/instructions.d.ts +4 -0
- package/dist/instructions.js +23 -0
- package/dist/policy/approval.d.ts +8 -0
- package/dist/policy/approval.js +27 -0
- package/dist/providers/ai-sdk.d.ts +10 -0
- package/dist/providers/ai-sdk.js +154 -0
- package/dist/providers/configured.d.ts +17 -0
- package/dist/providers/configured.js +60 -0
- package/dist/providers/openai-compatible.d.ts +8 -0
- package/dist/providers/openai-compatible.js +14 -0
- package/dist/providers/project-module.d.ts +7 -0
- package/dist/providers/project-module.js +29 -0
- package/dist/providers/registry.d.ts +20 -0
- package/dist/providers/registry.js +53 -0
- package/dist/readiness/check-readiness.d.ts +2 -0
- package/dist/readiness/check-readiness.js +33 -0
- package/dist/readiness/checks/approval-policy.d.ts +5 -0
- package/dist/readiness/checks/approval-policy.js +19 -0
- package/dist/readiness/checks/artifact-access.d.ts +3 -0
- package/dist/readiness/checks/artifact-access.js +5 -0
- package/dist/readiness/checks/artifacts.d.ts +6 -0
- package/dist/readiness/checks/artifacts.js +22 -0
- package/dist/readiness/checks/env.d.ts +3 -0
- package/dist/readiness/checks/env.js +10 -0
- package/dist/readiness/checks/evals.d.ts +2 -0
- package/dist/readiness/checks/evals.js +53 -0
- package/dist/readiness/checks/persistence.d.ts +3 -0
- package/dist/readiness/checks/persistence.js +61 -0
- package/dist/readiness/checks/project.d.ts +7 -0
- package/dist/readiness/checks/project.js +21 -0
- package/dist/readiness/checks/provider.d.ts +2 -0
- package/dist/readiness/checks/provider.js +20 -0
- package/dist/readiness/checks/server-config.d.ts +2 -0
- package/dist/readiness/checks/server-config.js +13 -0
- package/dist/readiness/checks/studio.d.ts +2 -0
- package/dist/readiness/checks/studio.js +16 -0
- package/dist/readiness/checks/thread-store.d.ts +3 -0
- package/dist/readiness/checks/thread-store.js +12 -0
- package/dist/readiness/checks/tools.d.ts +3 -0
- package/dist/readiness/checks/tools.js +42 -0
- package/dist/readiness/diagnostic.d.ts +2 -0
- package/dist/readiness/diagnostic.js +7 -0
- package/dist/readiness/index.d.ts +1 -0
- package/dist/readiness/index.js +1 -0
- package/dist/readiness/open-database.d.ts +8 -0
- package/dist/readiness/open-database.js +15 -0
- package/dist/run/artifact-tool-context.d.ts +19 -0
- package/dist/run/artifact-tool-context.js +74 -0
- package/dist/run/finalize.d.ts +16 -0
- package/dist/run/finalize.js +11 -0
- package/dist/run/index.d.ts +1 -0
- package/dist/run/index.js +1 -0
- package/dist/run/pinned-instructions.d.ts +18 -0
- package/dist/run/pinned-instructions.js +36 -0
- package/dist/run/record-tools.d.ts +8 -0
- package/dist/run/record-tools.js +21 -0
- package/dist/run/run-project.d.ts +17 -0
- package/dist/run/run-project.js +222 -0
- package/dist/run/strategies/approval.d.ts +9 -0
- package/dist/run/strategies/approval.js +42 -0
- package/dist/run/strategies/default-dry.d.ts +3 -0
- package/dist/run/strategies/default-dry.js +5 -0
- package/dist/run/strategies/provider.d.ts +6 -0
- package/dist/run/strategies/provider.js +193 -0
- package/dist/run/strategies/scripted.d.ts +5 -0
- package/dist/run/strategies/scripted.js +106 -0
- package/dist/run/tool-fingerprint.d.ts +2 -0
- package/dist/run/tool-fingerprint.js +26 -0
- package/dist/run/tool-step.d.ts +4 -0
- package/dist/run/tool-step.js +62 -0
- package/dist/run/tracing.d.ts +12 -0
- package/dist/run/tracing.js +92 -0
- package/dist/script.d.ts +4 -0
- package/dist/script.js +51 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +1 -0
- package/dist/storage/metadata.d.ts +5 -0
- package/dist/storage/metadata.js +26 -0
- package/dist/storage/sqlite/append-event.d.ts +3 -0
- package/dist/storage/sqlite/append-event.js +108 -0
- package/dist/storage/sqlite/driver.d.ts +9 -0
- package/dist/storage/sqlite/driver.js +13 -0
- package/dist/storage/sqlite/index.d.ts +1 -0
- package/dist/storage/sqlite/index.js +1 -0
- package/dist/storage/sqlite/open.d.ts +3 -0
- package/dist/storage/sqlite/open.js +54 -0
- package/dist/storage/sqlite/owner-lock.d.ts +5 -0
- package/dist/storage/sqlite/owner-lock.js +55 -0
- package/dist/storage/sqlite/project-thread.d.ts +4 -0
- package/dist/storage/sqlite/project-thread.js +33 -0
- package/dist/storage/sqlite/queries.d.ts +9 -0
- package/dist/storage/sqlite/queries.js +134 -0
- package/dist/storage/sqlite/recover-interrupted.d.ts +2 -0
- package/dist/storage/sqlite/recover-interrupted.js +46 -0
- package/dist/storage/sqlite/schema.d.ts +10 -0
- package/dist/storage/sqlite/schema.js +205 -0
- package/dist/storage/sqlite/store.d.ts +2 -0
- package/dist/storage/sqlite/store.js +51 -0
- package/dist/storage/sqlite/thread-log.d.ts +4 -0
- package/dist/storage/sqlite/thread-log.js +9 -0
- package/dist/storage/sqlite/thread-title.d.ts +24 -0
- package/dist/storage/sqlite/thread-title.js +85 -0
- package/dist/storage/sqlite/threads.d.ts +47 -0
- package/dist/storage/sqlite/threads.js +156 -0
- package/dist/threads/stopwords.d.ts +1 -0
- package/dist/threads/stopwords.js +16 -0
- package/dist/threads/suggest-title.d.ts +9 -0
- package/dist/threads/suggest-title.js +102 -0
- package/dist/threads/titler.d.ts +10 -0
- package/dist/threads/titler.js +63 -0
- package/dist/threads/words.d.ts +12 -0
- package/dist/threads/words.js +39 -0
- package/dist/tools/artifact-model-tool-operations.d.ts +29 -0
- package/dist/tools/artifact-model-tool-operations.js +124 -0
- package/dist/tools/artifact-model-tools.d.ts +2 -0
- package/dist/tools/artifact-model-tools.js +101 -0
- package/dist/tools/discover.d.ts +4 -0
- package/dist/tools/discover.js +34 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.js +3 -0
- package/dist/tools/load.d.ts +2 -0
- package/dist/tools/load.js +83 -0
- package/dist/tools/normalize.d.ts +2 -0
- package/dist/tools/normalize.js +48 -0
- package/dist/tools/schema.d.ts +7 -0
- package/dist/tools/schema.js +101 -0
- package/dist/tools/skill-model-tool.d.ts +7 -0
- package/dist/tools/skill-model-tool.js +38 -0
- package/dist/types/artifacts.d.ts +5 -0
- package/dist/types/artifacts.js +1 -0
- package/dist/types/evals.d.ts +16 -0
- package/dist/types/evals.js +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.js +1 -0
- package/dist/types/provider.d.ts +45 -0
- package/dist/types/provider.js +1 -0
- package/dist/types/readiness.d.ts +9 -0
- package/dist/types/readiness.js +1 -0
- package/dist/types/run.d.ts +28 -0
- package/dist/types/run.js +1 -0
- package/dist/types/script.d.ts +16 -0
- package/dist/types/script.js +1 -0
- package/dist/types/store.d.ts +24 -0
- package/dist/types/store.js +1 -0
- package/dist/types/tools.d.ts +15 -0
- package/dist/types/tools.js +1 -0
- package/package.json +67 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ThreadStore } from "../storage/sqlite/threads.js";
|
|
2
|
+
import type { EventStore } from "./store.js";
|
|
3
|
+
export interface ReadinessOptions {
|
|
4
|
+
databasePath?: string;
|
|
5
|
+
eventStore?: EventStore;
|
|
6
|
+
threadStore?: Pick<ThreadStore, "storageIdentity">;
|
|
7
|
+
/** Built Studio directory. Omit when Studio is not in use. */
|
|
8
|
+
studioPath?: string | undefined;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { JsonValue } from "@plico-ai/contracts";
|
|
2
|
+
import type { Engine } from "../engine/index.js";
|
|
3
|
+
import type { ModelProvider, ProviderMessage } from "./provider.js";
|
|
4
|
+
import type { DryRunScriptStep } from "./script.js";
|
|
5
|
+
import type { EventStore } from "./store.js";
|
|
6
|
+
export interface RunProjectOptions {
|
|
7
|
+
script?: DryRunScriptStep[];
|
|
8
|
+
/**
|
|
9
|
+
* Do not run tool handlers for scripted `tool.call` steps. Each step supplies its output as
|
|
10
|
+
* `result`; a step without one fails the run, and `live: true` opts a step back in to its handler.
|
|
11
|
+
*/
|
|
12
|
+
mockTools?: boolean;
|
|
13
|
+
eventStore?: EventStore;
|
|
14
|
+
/** Runs the loop durably. Defaults to an in-memory engine that does not survive the process. */
|
|
15
|
+
engine?: Engine;
|
|
16
|
+
runId?: string;
|
|
17
|
+
provider?: ModelProvider;
|
|
18
|
+
/** Opaque identity used to prevent recovery with a different provider configuration. */
|
|
19
|
+
providerRecoveryKey?: string;
|
|
20
|
+
message?: string;
|
|
21
|
+
threadId?: string;
|
|
22
|
+
/** Host data stamped on `run.started`. Immutable and returned by run reads and filters. */
|
|
23
|
+
metadata?: Record<string, JsonValue>;
|
|
24
|
+
/** Host data passed to tools as `ctx.context` and recorded on `run.started`. No secrets. */
|
|
25
|
+
context?: Record<string, JsonValue>;
|
|
26
|
+
history?: Array<Pick<ProviderMessage, "role" | "content">>;
|
|
27
|
+
onStarted?: (runId: string) => void;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ArtifactFileInput } from "./artifacts.js";
|
|
2
|
+
export type DryRunScriptStep = {
|
|
3
|
+
type: "assistant.output";
|
|
4
|
+
content: string;
|
|
5
|
+
} | {
|
|
6
|
+
type: "tool.call";
|
|
7
|
+
toolName: string;
|
|
8
|
+
arguments: unknown;
|
|
9
|
+
/** The output to use instead of running the tool, when the run mocks tools. */
|
|
10
|
+
result?: unknown;
|
|
11
|
+
/** Run the real handler even when the run mocks tools. */
|
|
12
|
+
live?: true;
|
|
13
|
+
} | {
|
|
14
|
+
type: "artifact.write";
|
|
15
|
+
files: ArtifactFileInput[];
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { EvalReport, JsonValue, PlicoEvent, RunSummary } from "@plico-ai/contracts";
|
|
2
|
+
export interface EventStore {
|
|
3
|
+
readonly storageIdentity?: string;
|
|
4
|
+
appendEvent(event: PlicoEvent): Promise<void>;
|
|
5
|
+
/** Lists runs, newest first. `metadata` keeps runs whose top-level keys equal every given value. */
|
|
6
|
+
listRuns(filter?: {
|
|
7
|
+
metadata?: Record<string, JsonValue>;
|
|
8
|
+
}): Promise<RunSummary[]>;
|
|
9
|
+
getRun(runId: string): Promise<RunSummary | undefined>;
|
|
10
|
+
getEvents(runId: string, options?: {
|
|
11
|
+
afterSequence?: number;
|
|
12
|
+
}): Promise<PlicoEvent[]>;
|
|
13
|
+
/** Returns run events in a thread, ordered by their durable insertion order. */
|
|
14
|
+
getThreadRunEvents?(threadId: string): Promise<PlicoEvent[]>;
|
|
15
|
+
/** Returns thread run events through the selected run's final durable position. */
|
|
16
|
+
getThreadRunEventsThrough?(threadId: string, runId: string): Promise<PlicoEvent[]>;
|
|
17
|
+
persistEvalReport(report: EvalReport): Promise<void>;
|
|
18
|
+
getLatestEvalReport(): Promise<EvalReport | undefined>;
|
|
19
|
+
}
|
|
20
|
+
export interface CreateSqliteEventStoreOptions {
|
|
21
|
+
databasePath: string;
|
|
22
|
+
/** Open an existing database without changing it. Adds no files unless it has a pending WAL. */
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { JsonSchema, ToolDefinition } from "@plico-ai/contracts";
|
|
2
|
+
export type { JsonSchema, JsonSchemaObject, ToolApprovalPolicy, ToolArtifactContext, ToolArtifactFile, ToolDefinition, ToolHandlerContext, ToolInputSchema, ZodInputParseResult, ZodInputSchema, } from "@plico-ai/contracts";
|
|
3
|
+
export type ToolInputParseResult = {
|
|
4
|
+
success: true;
|
|
5
|
+
value: unknown;
|
|
6
|
+
} | {
|
|
7
|
+
success: false;
|
|
8
|
+
error: string;
|
|
9
|
+
};
|
|
10
|
+
export interface DeclaredTool extends Omit<ToolDefinition, "inputSchema"> {
|
|
11
|
+
source: string;
|
|
12
|
+
inputSchema: JsonSchema;
|
|
13
|
+
validateInput(input: unknown): Promise<string | undefined>;
|
|
14
|
+
parseInput(input: unknown): Promise<ToolInputParseResult>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,21 +1,80 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plico-ai/runtime",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Plico runtime: linear agent runs, durable event log, tools, evals and readiness checks",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://plico.sohab.dev",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/ITZSHOAIB/plico.git"
|
|
9
|
+
"url": "git+https://github.com/ITZSHOAIB/plico.git",
|
|
10
|
+
"directory": "packages/runtime"
|
|
10
11
|
},
|
|
11
12
|
"keywords": [
|
|
12
13
|
"plico",
|
|
13
|
-
"agent"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"README.md"
|
|
14
|
+
"agent",
|
|
15
|
+
"runtime",
|
|
16
|
+
"evals"
|
|
17
17
|
],
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"NOTICE",
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@ai-sdk/openai-compatible": "^3.0.84",
|
|
36
|
+
"@opentelemetry/api": "1.9.0",
|
|
37
|
+
"ai": "^7.0.162",
|
|
38
|
+
"ajv": "8.20.0",
|
|
39
|
+
"ajv-formats": "3.0.1",
|
|
40
|
+
"mime": "4.1.2",
|
|
41
|
+
"picomatch": "4.0.4",
|
|
42
|
+
"tsx": "4.22.4",
|
|
43
|
+
"zod-to-json-schema": "3.25.2",
|
|
44
|
+
"@plico-ai/contracts": "0.1.0",
|
|
45
|
+
"@plico-ai/core": "0.1.0"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=22.18.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@ai-sdk/anthropic": "^4.0.99",
|
|
52
|
+
"@ai-sdk/google": "^4.0.114",
|
|
53
|
+
"@ai-sdk/openai": "^4.0.111",
|
|
54
|
+
"@opentelemetry/context-async-hooks": "2.0.1",
|
|
55
|
+
"@opentelemetry/sdk-trace-base": "2.0.1",
|
|
56
|
+
"@types/picomatch": "^4.0.3",
|
|
57
|
+
"zod": "3.25.76"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"@ai-sdk/anthropic": "^4.0.99",
|
|
61
|
+
"@ai-sdk/google": "^4.0.114",
|
|
62
|
+
"@ai-sdk/openai": "^4.0.111"
|
|
63
|
+
},
|
|
64
|
+
"peerDependenciesMeta": {
|
|
65
|
+
"@ai-sdk/anthropic": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
68
|
+
"@ai-sdk/google": {
|
|
69
|
+
"optional": true
|
|
70
|
+
},
|
|
71
|
+
"@ai-sdk/openai": {
|
|
72
|
+
"optional": true
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"scripts": {
|
|
76
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
77
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json",
|
|
78
|
+
"test": "vitest run"
|
|
20
79
|
}
|
|
21
|
-
}
|
|
80
|
+
}
|