@plico-ai/contracts 0.0.0-stage → 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/LICENSE +202 -0
- package/NOTICE +4 -0
- package/README.md +8 -2
- package/dist/artifacts.d.ts +59 -0
- package/dist/artifacts.js +1 -0
- package/dist/evals.d.ts +22 -0
- package/dist/evals.js +1 -0
- package/dist/events.d.ts +167 -0
- package/dist/events.js +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1 -0
- package/dist/instructions.d.ts +4 -0
- package/dist/instructions.js +1 -0
- package/dist/project.d.ts +57 -0
- package/dist/project.js +1 -0
- package/dist/readiness.d.ts +17 -0
- package/dist/readiness.js +1 -0
- package/dist/runs.d.ts +21 -0
- package/dist/runs.js +1 -0
- package/dist/threads.d.ts +43 -0
- package/dist/threads.js +1 -0
- package/dist/tools.d.ts +66 -0
- package/dist/tools.js +1 -0
- package/package.json +37 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @plico-ai/contracts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Types-only contracts shared by every Plico package and surface: project/validation results, native events, run results, artifacts, eval results, readiness reports and composed instructions.
|
|
4
|
+
|
|
5
|
+
Rules:
|
|
6
|
+
|
|
7
|
+
- No runtime code and no dependencies. Everything is `export type`.
|
|
8
|
+
- Packages import these types instead of redefining them (Studio, the server, the CLI and the future React kit all consume the same shapes).
|
|
9
|
+
- Changing a shape here is a public contract change; add versions explicitly.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type ArtifactContent = string | {
|
|
2
|
+
encoding: "base64";
|
|
3
|
+
data: string;
|
|
4
|
+
};
|
|
5
|
+
export interface ArtifactFileMetadata {
|
|
6
|
+
path: string;
|
|
7
|
+
sizeBytes: number;
|
|
8
|
+
mimeType: string;
|
|
9
|
+
version: number;
|
|
10
|
+
contentHash: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ArtifactFile {
|
|
13
|
+
path: string;
|
|
14
|
+
content: ArtifactContent;
|
|
15
|
+
mimeType: string;
|
|
16
|
+
/** Starts at 1 and increments each time the path is rewritten. */
|
|
17
|
+
version: number;
|
|
18
|
+
contentHash: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ArtifactVersion {
|
|
21
|
+
path: string;
|
|
22
|
+
mimeType: string;
|
|
23
|
+
version: number;
|
|
24
|
+
contentHash: string;
|
|
25
|
+
runId: string;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ArtifactDiff {
|
|
29
|
+
path: string;
|
|
30
|
+
fromVersion: number;
|
|
31
|
+
toVersion: number;
|
|
32
|
+
diff: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ArtifactSnapshot {
|
|
35
|
+
snapshotId: string;
|
|
36
|
+
runId: string;
|
|
37
|
+
fileCount: number;
|
|
38
|
+
createdAt: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ArtifactSnapshotDetail extends ArtifactSnapshot {
|
|
41
|
+
files: ArtifactFile[];
|
|
42
|
+
}
|
|
43
|
+
export interface ArtifactWorkspace {
|
|
44
|
+
workspaceId: string;
|
|
45
|
+
runId: string;
|
|
46
|
+
threadId?: string;
|
|
47
|
+
files: ArtifactFile[];
|
|
48
|
+
versions: ArtifactVersion[];
|
|
49
|
+
snapshots: ArtifactSnapshot[];
|
|
50
|
+
createdAt: string;
|
|
51
|
+
}
|
|
52
|
+
export interface ThreadArtifactWorkspace {
|
|
53
|
+
workspaceId: string;
|
|
54
|
+
threadId: string;
|
|
55
|
+
files: ArtifactFile[];
|
|
56
|
+
versions: ArtifactVersion[];
|
|
57
|
+
snapshots: ArtifactSnapshot[];
|
|
58
|
+
createdAt: string;
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/evals.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RunStatus } from "./runs.js";
|
|
2
|
+
export interface EvalCaseResult {
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
status: "pass" | "fail";
|
|
6
|
+
runId: string;
|
|
7
|
+
runStatus: RunStatus;
|
|
8
|
+
output?: string;
|
|
9
|
+
diagnostics?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface EvalSummary {
|
|
12
|
+
total: number;
|
|
13
|
+
passed: number;
|
|
14
|
+
failed: number;
|
|
15
|
+
results: EvalCaseResult[];
|
|
16
|
+
}
|
|
17
|
+
export interface EvalReport extends EvalSummary {
|
|
18
|
+
schemaVersion: 1;
|
|
19
|
+
evaluatedAt: string;
|
|
20
|
+
/** Identifies the fixtures this report ran, so readers can detect stale results. */
|
|
21
|
+
fixturesDigest: string;
|
|
22
|
+
}
|
package/dist/evals.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { ArtifactContent } from "./artifacts.js";
|
|
2
|
+
import type { ValidationIssue } from "./project.js";
|
|
3
|
+
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
4
|
+
[key: string]: JsonValue;
|
|
5
|
+
};
|
|
6
|
+
export interface ModelToolCall {
|
|
7
|
+
id?: string;
|
|
8
|
+
name: string;
|
|
9
|
+
arguments: unknown;
|
|
10
|
+
providerMetadata?: JsonValue;
|
|
11
|
+
}
|
|
12
|
+
export interface PlicoEventPayloads {
|
|
13
|
+
"run.started": {
|
|
14
|
+
projectRoot: string;
|
|
15
|
+
projectName: string;
|
|
16
|
+
threadId?: string;
|
|
17
|
+
metadata?: Record<string, JsonValue>;
|
|
18
|
+
context?: Record<string, JsonValue>;
|
|
19
|
+
};
|
|
20
|
+
"instructions.composed": {
|
|
21
|
+
length: number;
|
|
22
|
+
sources: string[];
|
|
23
|
+
content: string;
|
|
24
|
+
/** The skills the run started with, so a resumed run keeps them. Absent on older runs. */
|
|
25
|
+
skills?: Array<{
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
source: string;
|
|
29
|
+
body: string;
|
|
30
|
+
}>;
|
|
31
|
+
};
|
|
32
|
+
"tools.discovered": {
|
|
33
|
+
tools: Array<{
|
|
34
|
+
source: string;
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
inputSchema: unknown;
|
|
38
|
+
capabilities: string[];
|
|
39
|
+
approval: {
|
|
40
|
+
required: boolean;
|
|
41
|
+
reason?: string;
|
|
42
|
+
};
|
|
43
|
+
}>;
|
|
44
|
+
/** Hash of the TypeScript files in `tools/`, so a resumed run can tell the tool code changed. */
|
|
45
|
+
fingerprint?: string;
|
|
46
|
+
};
|
|
47
|
+
"input.received": {
|
|
48
|
+
content: string;
|
|
49
|
+
};
|
|
50
|
+
"model.request": {
|
|
51
|
+
model?: {
|
|
52
|
+
provider: string;
|
|
53
|
+
name: string;
|
|
54
|
+
};
|
|
55
|
+
messages: Array<{
|
|
56
|
+
role: string;
|
|
57
|
+
content: string;
|
|
58
|
+
toolName?: string;
|
|
59
|
+
toolCallId?: string;
|
|
60
|
+
toolCalls?: ModelToolCall[];
|
|
61
|
+
providerMetadata?: JsonValue;
|
|
62
|
+
}>;
|
|
63
|
+
maxSteps: number;
|
|
64
|
+
tools: Array<{
|
|
65
|
+
name: string;
|
|
66
|
+
description: string;
|
|
67
|
+
inputSchema: unknown;
|
|
68
|
+
}>;
|
|
69
|
+
};
|
|
70
|
+
"model.attempt": {
|
|
71
|
+
turn: number;
|
|
72
|
+
attemptId: string;
|
|
73
|
+
};
|
|
74
|
+
"model.delta": {
|
|
75
|
+
turn: number;
|
|
76
|
+
attemptId: string;
|
|
77
|
+
text: string;
|
|
78
|
+
};
|
|
79
|
+
"model.response": {
|
|
80
|
+
attemptId?: string;
|
|
81
|
+
providerMetadata?: JsonValue;
|
|
82
|
+
content: string;
|
|
83
|
+
usage: {
|
|
84
|
+
inputTokens: number;
|
|
85
|
+
outputTokens: number;
|
|
86
|
+
};
|
|
87
|
+
toolCalls?: ModelToolCall[] | undefined;
|
|
88
|
+
};
|
|
89
|
+
"assistant.output": {
|
|
90
|
+
content: string;
|
|
91
|
+
};
|
|
92
|
+
"tool.call": {
|
|
93
|
+
toolName: string;
|
|
94
|
+
arguments: unknown;
|
|
95
|
+
};
|
|
96
|
+
"tool.result": {
|
|
97
|
+
toolName: string;
|
|
98
|
+
result: unknown;
|
|
99
|
+
};
|
|
100
|
+
"approval.requested": {
|
|
101
|
+
requestId: string;
|
|
102
|
+
toolName: string;
|
|
103
|
+
arguments: unknown;
|
|
104
|
+
approval: {
|
|
105
|
+
required: boolean;
|
|
106
|
+
reason?: string;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
"approval.decided": {
|
|
110
|
+
requestId: string;
|
|
111
|
+
approved: boolean;
|
|
112
|
+
/** The context of whoever decided, as the host passed it. */
|
|
113
|
+
context?: Record<string, JsonValue>;
|
|
114
|
+
};
|
|
115
|
+
"artifact.workspace.created": {
|
|
116
|
+
workspaceId: string;
|
|
117
|
+
};
|
|
118
|
+
"artifact.file.written": {
|
|
119
|
+
path: string;
|
|
120
|
+
content: ArtifactContent;
|
|
121
|
+
mimeType: string;
|
|
122
|
+
contentHash?: string;
|
|
123
|
+
version?: number;
|
|
124
|
+
};
|
|
125
|
+
"artifact.snapshot.created": {
|
|
126
|
+
snapshotId: string;
|
|
127
|
+
fileCount: number;
|
|
128
|
+
};
|
|
129
|
+
"run.completed": {
|
|
130
|
+
output?: string;
|
|
131
|
+
};
|
|
132
|
+
"run.waiting": {
|
|
133
|
+
requestId: string;
|
|
134
|
+
toolName: string;
|
|
135
|
+
output?: string;
|
|
136
|
+
};
|
|
137
|
+
"run.failed": {
|
|
138
|
+
phase: string;
|
|
139
|
+
};
|
|
140
|
+
"run.cancelled": Record<string, never>;
|
|
141
|
+
"run.error": {
|
|
142
|
+
phase: string;
|
|
143
|
+
message?: string;
|
|
144
|
+
issues?: ValidationIssue[];
|
|
145
|
+
toolName?: string;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
export type PlicoEventType = keyof PlicoEventPayloads;
|
|
149
|
+
export type EventStreamType = "run" | "thread";
|
|
150
|
+
interface EventEnvelope {
|
|
151
|
+
schemaVersion: 1;
|
|
152
|
+
streamType: "run";
|
|
153
|
+
/** Canonical location in the log. */
|
|
154
|
+
streamId: string;
|
|
155
|
+
/** Always equals `streamId` on run streams. */
|
|
156
|
+
runId: string;
|
|
157
|
+
id: string;
|
|
158
|
+
sequence: number;
|
|
159
|
+
timestamp: string;
|
|
160
|
+
}
|
|
161
|
+
export type PlicoEvent<T extends PlicoEventType = PlicoEventType> = {
|
|
162
|
+
[K in T]: EventEnvelope & {
|
|
163
|
+
type: K;
|
|
164
|
+
payload: PlicoEventPayloads[K];
|
|
165
|
+
};
|
|
166
|
+
}[T];
|
|
167
|
+
export {};
|
package/dist/events.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { ArtifactContent, ArtifactDiff, ArtifactFile, ArtifactFileMetadata, ArtifactSnapshot, ArtifactSnapshotDetail, ArtifactVersion, ArtifactWorkspace, ThreadArtifactWorkspace, } from "./artifacts.js";
|
|
2
|
+
export type { EvalCaseResult, EvalReport, EvalSummary } from "./evals.js";
|
|
3
|
+
export type { EventStreamType, JsonValue, ModelToolCall, PlicoEvent, PlicoEventPayloads, PlicoEventType, } from "./events.js";
|
|
4
|
+
export type { ComposedInstructions } from "./instructions.js";
|
|
5
|
+
export type { LoadedProject, ProjectConfig, ProviderInput, ValidationIssue, ValidationResult, ValidationSeverity, } from "./project.js";
|
|
6
|
+
export type { DiagnosticSeverity, ReadinessDiagnostic, ReadinessReport, } from "./readiness.js";
|
|
7
|
+
export type { RunResult, RunStatus, RunSummary } from "./runs.js";
|
|
8
|
+
export type { Thread, ThreadEvent, ThreadMessage } from "./threads.js";
|
|
9
|
+
export type { JsonSchema, JsonSchemaObject, ToolApprovalPolicy, ToolArtifactContext, ToolArtifactFile, ToolDefinition, ToolHandlerContext, ToolInputSchema, ZodInputParseResult, ZodInputSchema, } from "./tools.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type ValidationSeverity = "error" | "warning";
|
|
2
|
+
export interface ValidationIssue {
|
|
3
|
+
path: string;
|
|
4
|
+
message: string;
|
|
5
|
+
severity: ValidationSeverity;
|
|
6
|
+
}
|
|
7
|
+
export interface ProjectConfig {
|
|
8
|
+
schemaVersion: number;
|
|
9
|
+
name: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
template?: string;
|
|
12
|
+
artifacts?: {
|
|
13
|
+
access: "read-write" | "read-only" | "off";
|
|
14
|
+
};
|
|
15
|
+
model?: {
|
|
16
|
+
provider: string;
|
|
17
|
+
name: string;
|
|
18
|
+
/** Endpoint for `openai-compatible` (and `openai`). */
|
|
19
|
+
baseURL?: string;
|
|
20
|
+
/** Environment variable holding the API key. Defaults to the provider's usual variable. */
|
|
21
|
+
apiKeyEnv?: string;
|
|
22
|
+
maxSteps?: number;
|
|
23
|
+
retries?: number;
|
|
24
|
+
retryDelayMs?: number;
|
|
25
|
+
};
|
|
26
|
+
execution?: {
|
|
27
|
+
leaseMs?: number;
|
|
28
|
+
};
|
|
29
|
+
/** Thread naming. `keywords` is the default; `model` asks the configured model to write titles. */
|
|
30
|
+
threads?: {
|
|
31
|
+
title?: "keywords" | "model";
|
|
32
|
+
};
|
|
33
|
+
approvals?: {
|
|
34
|
+
default?: "none" | "required";
|
|
35
|
+
timeoutMs?: number;
|
|
36
|
+
tools?: Record<string, "none" | "required">;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** What the default export of `providers/<name>.ts` receives. It returns an AI SDK language model. */
|
|
40
|
+
export interface ProviderInput {
|
|
41
|
+
model: string;
|
|
42
|
+
/** The value of the variable named by `model.apiKeyEnv`, when the config names one. */
|
|
43
|
+
apiKey?: string;
|
|
44
|
+
baseURL?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface LoadedProject {
|
|
47
|
+
root: string;
|
|
48
|
+
configPath: string;
|
|
49
|
+
config: ProjectConfig;
|
|
50
|
+
}
|
|
51
|
+
export interface ValidationResult {
|
|
52
|
+
ok: boolean;
|
|
53
|
+
issues: ValidationIssue[];
|
|
54
|
+
errors: ValidationIssue[];
|
|
55
|
+
warnings: ValidationIssue[];
|
|
56
|
+
project?: LoadedProject;
|
|
57
|
+
}
|
package/dist/project.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type DiagnosticSeverity = "ok" | "warning" | "error";
|
|
2
|
+
export interface ReadinessDiagnostic {
|
|
3
|
+
severity: DiagnosticSeverity;
|
|
4
|
+
subsystem: string;
|
|
5
|
+
path?: string;
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ReadinessReport {
|
|
9
|
+
projectRoot: string;
|
|
10
|
+
timestamp: string;
|
|
11
|
+
diagnostics: ReadinessDiagnostic[];
|
|
12
|
+
summary: {
|
|
13
|
+
ok: number;
|
|
14
|
+
warning: number;
|
|
15
|
+
error: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/runs.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { JsonValue, PlicoEvent } from "./events.js";
|
|
2
|
+
import type { ValidationIssue } from "./project.js";
|
|
3
|
+
export type RunStatus = "running" | "completed" | "failed" | "waiting" | "cancelled";
|
|
4
|
+
export interface RunSummary {
|
|
5
|
+
runId: string;
|
|
6
|
+
projectRoot: string;
|
|
7
|
+
projectName: string;
|
|
8
|
+
status: RunStatus;
|
|
9
|
+
startedAt: string;
|
|
10
|
+
endedAt: string | null;
|
|
11
|
+
output?: string;
|
|
12
|
+
/** Host data set when the run started and never changed. */
|
|
13
|
+
metadata?: Record<string, JsonValue>;
|
|
14
|
+
}
|
|
15
|
+
export interface RunResult {
|
|
16
|
+
runId: string;
|
|
17
|
+
status: RunStatus;
|
|
18
|
+
output?: string;
|
|
19
|
+
events: PlicoEvent[];
|
|
20
|
+
errors?: ValidationIssue[];
|
|
21
|
+
}
|
package/dist/runs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { JsonValue } from "./events.js";
|
|
2
|
+
export interface Thread {
|
|
3
|
+
id: string;
|
|
4
|
+
createdAt: string;
|
|
5
|
+
/** Absent until the conversation has a topic or the user names it. */
|
|
6
|
+
title?: string;
|
|
7
|
+
/** Host data set at creation and never changed. */
|
|
8
|
+
metadata?: Record<string, JsonValue>;
|
|
9
|
+
}
|
|
10
|
+
export interface ThreadMessage {
|
|
11
|
+
id: string;
|
|
12
|
+
threadId: string;
|
|
13
|
+
role: "user" | "assistant";
|
|
14
|
+
runId?: string;
|
|
15
|
+
content: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
}
|
|
18
|
+
interface ThreadEventEnvelope {
|
|
19
|
+
schemaVersion: 1;
|
|
20
|
+
streamType: "thread";
|
|
21
|
+
streamId: string;
|
|
22
|
+
sequence: number;
|
|
23
|
+
id: string;
|
|
24
|
+
timestamp: string;
|
|
25
|
+
}
|
|
26
|
+
export type ThreadEvent = (ThreadEventEnvelope & {
|
|
27
|
+
type: "thread.created";
|
|
28
|
+
payload: {
|
|
29
|
+
thread: Thread;
|
|
30
|
+
};
|
|
31
|
+
}) | (ThreadEventEnvelope & {
|
|
32
|
+
type: "message.created";
|
|
33
|
+
payload: {
|
|
34
|
+
message: ThreadMessage;
|
|
35
|
+
};
|
|
36
|
+
}) | (ThreadEventEnvelope & {
|
|
37
|
+
type: "thread.titled";
|
|
38
|
+
payload: {
|
|
39
|
+
title: string;
|
|
40
|
+
source: "generated" | "user";
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
export {};
|
package/dist/threads.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ArtifactFileMetadata } from "./artifacts.js";
|
|
2
|
+
import type { JsonValue } from "./events.js";
|
|
3
|
+
export interface ToolArtifactFile {
|
|
4
|
+
path: string;
|
|
5
|
+
content: string | Uint8Array;
|
|
6
|
+
mimeType: string;
|
|
7
|
+
version: number;
|
|
8
|
+
contentHash: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ToolArtifactContext {
|
|
11
|
+
read(path: string): Promise<ToolArtifactFile | undefined>;
|
|
12
|
+
write(path: string, content: string | Uint8Array, options?: {
|
|
13
|
+
mimeType?: string;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
path: string;
|
|
16
|
+
version: number;
|
|
17
|
+
}>;
|
|
18
|
+
list(): Promise<ArtifactFileMetadata[]>;
|
|
19
|
+
}
|
|
20
|
+
export interface JsonSchemaObject {
|
|
21
|
+
[keyword: string]: JsonValue | undefined;
|
|
22
|
+
}
|
|
23
|
+
export type JsonSchema = JsonSchemaObject | boolean;
|
|
24
|
+
export interface ZodInputSchema {
|
|
25
|
+
safeParseAsync(input: unknown): Promise<ZodInputParseResult>;
|
|
26
|
+
}
|
|
27
|
+
export type ZodInputParseResult = {
|
|
28
|
+
success: true;
|
|
29
|
+
data: unknown;
|
|
30
|
+
} | {
|
|
31
|
+
success: false;
|
|
32
|
+
error: {
|
|
33
|
+
issues: Array<{
|
|
34
|
+
path: Array<string | number | symbol>;
|
|
35
|
+
message: string;
|
|
36
|
+
}>;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type ToolInputSchema = JsonSchema | ZodInputSchema;
|
|
40
|
+
export interface ToolApprovalPolicy {
|
|
41
|
+
required: boolean;
|
|
42
|
+
reason?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface ToolHandlerContext {
|
|
45
|
+
/** Aborts when the run is cancelled. Pass it to fetch or a child process to stop early. */
|
|
46
|
+
signal: AbortSignal;
|
|
47
|
+
/**
|
|
48
|
+
* Names this tool call and stays the same if the call runs again after a crash. Pass it to
|
|
49
|
+
* an API that accepts an idempotency key so a repeat does not act twice.
|
|
50
|
+
*/
|
|
51
|
+
idempotencyKey: string;
|
|
52
|
+
artifacts: ToolArtifactContext;
|
|
53
|
+
/**
|
|
54
|
+
* Data the host passed when it started the run, such as the calling user. It is recorded in the
|
|
55
|
+
* run's event log, so it must not carry secrets.
|
|
56
|
+
*/
|
|
57
|
+
context?: Record<string, JsonValue>;
|
|
58
|
+
}
|
|
59
|
+
export interface ToolDefinition {
|
|
60
|
+
name: string;
|
|
61
|
+
description: string;
|
|
62
|
+
inputSchema: ToolInputSchema;
|
|
63
|
+
capabilities: string[];
|
|
64
|
+
approval: ToolApprovalPolicy;
|
|
65
|
+
handler: (input: unknown, context: ToolHandlerContext) => unknown | Promise<unknown>;
|
|
66
|
+
}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plico-ai/contracts",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Types-only shared contracts (events, runs, artifacts, evals, readiness) for Plico packages",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"homepage": "https://plico.sohab.dev",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/ITZSHOAIB/plico.git",
|
|
10
|
+
"directory": "packages/contracts"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"plico",
|
|
14
|
+
"agent",
|
|
15
|
+
"types"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"type": "module",
|
|
21
|
+
"main": "./dist/index.js",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"default": "./dist/index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"NOTICE",
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=22.18.0"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
38
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json"
|
|
39
|
+
}
|
|
6
40
|
}
|