@agent-workspace/cli 0.2.1 → 0.5.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/dist/commands/artifact.d.ts +1 -0
- package/dist/commands/artifact.d.ts.map +1 -1
- package/dist/commands/artifact.js +76 -15
- package/dist/commands/artifact.js.map +1 -1
- package/dist/commands/contract.d.ts +32 -0
- package/dist/commands/contract.d.ts.map +1 -0
- package/dist/commands/contract.js +237 -0
- package/dist/commands/contract.js.map +1 -0
- package/dist/commands/identity.d.ts.map +1 -1
- package/dist/commands/identity.js +3 -2
- package/dist/commands/identity.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +6 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/inspect.d.ts.map +1 -1
- package/dist/commands/inspect.js +30 -0
- package/dist/commands/inspect.js.map +1 -1
- package/dist/commands/memory.d.ts +12 -1
- package/dist/commands/memory.d.ts.map +1 -1
- package/dist/commands/memory.js +72 -18
- package/dist/commands/memory.js.map +1 -1
- package/dist/commands/project.d.ts +23 -0
- package/dist/commands/project.d.ts.map +1 -0
- package/dist/commands/project.js +181 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/reputation.d.ts +25 -0
- package/dist/commands/reputation.d.ts.map +1 -0
- package/dist/commands/reputation.js +227 -0
- package/dist/commands/reputation.js.map +1 -0
- package/dist/commands/status.d.ts +5 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +182 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/swarm.d.ts +40 -0
- package/dist/commands/swarm.d.ts.map +1 -0
- package/dist/commands/swarm.js +373 -0
- package/dist/commands/swarm.js.map +1 -0
- package/dist/commands/task.d.ts +41 -0
- package/dist/commands/task.d.ts.map +1 -0
- package/dist/commands/task.js +381 -0
- package/dist/commands/task.js.map +1 -0
- package/dist/commands/validate.d.ts +3 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +101 -3
- package/dist/commands/validate.js.map +1 -1
- package/dist/index.js +198 -20
- package/dist/index.js.map +1 -1
- package/dist/lib/artifact.d.ts +2 -8
- package/dist/lib/artifact.d.ts.map +1 -1
- package/dist/lib/artifact.js +3 -21
- package/dist/lib/artifact.js.map +1 -1
- package/dist/lib/artifact.test.d.ts +2 -0
- package/dist/lib/artifact.test.d.ts.map +1 -0
- package/dist/lib/artifact.test.js +41 -0
- package/dist/lib/artifact.test.js.map +1 -0
- package/dist/lib/contract.d.ts +27 -0
- package/dist/lib/contract.d.ts.map +1 -0
- package/dist/lib/contract.js +83 -0
- package/dist/lib/contract.js.map +1 -0
- package/dist/lib/frontmatter.d.ts +2 -11
- package/dist/lib/frontmatter.d.ts.map +1 -1
- package/dist/lib/frontmatter.js +2 -25
- package/dist/lib/frontmatter.js.map +1 -1
- package/dist/lib/project.d.ts +54 -0
- package/dist/lib/project.d.ts.map +1 -0
- package/dist/lib/project.js +153 -0
- package/dist/lib/project.js.map +1 -0
- package/dist/lib/reputation.d.ts +20 -0
- package/dist/lib/reputation.d.ts.map +1 -0
- package/dist/lib/reputation.js +51 -0
- package/dist/lib/reputation.js.map +1 -0
- package/dist/lib/reputation.test.d.ts +2 -0
- package/dist/lib/reputation.test.d.ts.map +1 -0
- package/dist/lib/reputation.test.js +112 -0
- package/dist/lib/reputation.test.js.map +1 -0
- package/dist/lib/schema.d.ts.map +1 -1
- package/dist/lib/schema.js +9 -5
- package/dist/lib/schema.js.map +1 -1
- package/dist/lib/swarm.d.ts +22 -0
- package/dist/lib/swarm.d.ts.map +1 -0
- package/dist/lib/swarm.js +59 -0
- package/dist/lib/swarm.js.map +1 -0
- package/dist/lib/workspace.d.ts +3 -9
- package/dist/lib/workspace.d.ts.map +1 -1
- package/dist/lib/workspace.js +6 -42
- package/dist/lib/workspace.js.map +1 -1
- package/dist/lib/workspace.test.d.ts +2 -0
- package/dist/lib/workspace.test.d.ts.map +1 -0
- package/dist/lib/workspace.test.js +36 -0
- package/dist/lib/workspace.test.js.map +1 -0
- package/package.json +8 -2
package/dist/index.js
CHANGED
|
@@ -4,14 +4,17 @@ import { AWP_VERSION } from "@agent-workspace/core";
|
|
|
4
4
|
import { initCommand } from "./commands/init.js";
|
|
5
5
|
import { validateCommand } from "./commands/validate.js";
|
|
6
6
|
import { inspectCommand } from "./commands/inspect.js";
|
|
7
|
-
import { identityGenerateCommand, identityExportCommand
|
|
7
|
+
import { identityGenerateCommand, identityExportCommand } from "./commands/identity.js";
|
|
8
8
|
import { memoryLogCommand, memorySearchCommand } from "./commands/memory.js";
|
|
9
9
|
import { artifactCreateCommand, artifactCommitCommand, artifactLogCommand, artifactListCommand, artifactSearchCommand, artifactMergeCommand, } from "./commands/artifact.js";
|
|
10
|
+
import { reputationQueryCommand, reputationSignalCommand, reputationListCommand, } from "./commands/reputation.js";
|
|
11
|
+
import { contractCreateCommand, contractListCommand, contractShowCommand, contractEvaluateCommand, } from "./commands/contract.js";
|
|
12
|
+
import { projectCreateCommand, projectListCommand, projectShowCommand, projectCloseCommand, } from "./commands/project.js";
|
|
13
|
+
import { taskCreateCommand, taskListCommand, taskUpdateCommand, taskShowCommand, taskGraphCommand, } from "./commands/task.js";
|
|
14
|
+
import { swarmCreateCommand, swarmRoleAddCommand, swarmRecruitCommand, swarmShowCommand, swarmListCommand, swarmUpdateCommand, } from "./commands/swarm.js";
|
|
15
|
+
import { statusCommand } from "./commands/status.js";
|
|
10
16
|
const program = new Command();
|
|
11
|
-
program
|
|
12
|
-
.name("awp")
|
|
13
|
-
.description("Agent Workspace Protocol — CLI tool")
|
|
14
|
-
.version(AWP_VERSION);
|
|
17
|
+
program.name("awp").description("Agent Workspace Protocol — CLI tool").version(AWP_VERSION);
|
|
15
18
|
// awp init [dir]
|
|
16
19
|
program
|
|
17
20
|
.command("init")
|
|
@@ -23,16 +26,12 @@ program
|
|
|
23
26
|
program
|
|
24
27
|
.command("validate")
|
|
25
28
|
.description("Validate the current AWP workspace")
|
|
29
|
+
.option("--quick", "Only validate core files (skip content directories)")
|
|
26
30
|
.action(validateCommand);
|
|
27
31
|
// awp inspect
|
|
28
|
-
program
|
|
29
|
-
.command("inspect")
|
|
30
|
-
.description("Show workspace summary")
|
|
31
|
-
.action(inspectCommand);
|
|
32
|
+
program.command("inspect").description("Show workspace summary").action(inspectCommand);
|
|
32
33
|
// awp identity
|
|
33
|
-
const identity = program
|
|
34
|
-
.command("identity")
|
|
35
|
-
.description("Agent identity operations");
|
|
34
|
+
const identity = program.command("identity").description("Agent identity operations");
|
|
36
35
|
identity
|
|
37
36
|
.command("generate")
|
|
38
37
|
.description("Generate a DID for this agent")
|
|
@@ -43,9 +42,7 @@ identity
|
|
|
43
42
|
.option("-f, --format <format>", "Output format (json)", "json")
|
|
44
43
|
.action(identityExportCommand);
|
|
45
44
|
// awp memory
|
|
46
|
-
const memory = program
|
|
47
|
-
.command("memory")
|
|
48
|
-
.description("Memory operations");
|
|
45
|
+
const memory = program.command("memory").description("Memory operations");
|
|
49
46
|
memory
|
|
50
47
|
.command("log")
|
|
51
48
|
.description("Append an entry to today's memory log")
|
|
@@ -54,13 +51,16 @@ memory
|
|
|
54
51
|
.action(memoryLogCommand);
|
|
55
52
|
memory
|
|
56
53
|
.command("search")
|
|
57
|
-
.description("Search memory entries")
|
|
54
|
+
.description("Search memory entries with optional fuzzy matching and date filters")
|
|
58
55
|
.argument("<query>", "Search query")
|
|
56
|
+
.option("--from <date>", "Start date (YYYY-MM-DD)")
|
|
57
|
+
.option("--to <date>", "End date (YYYY-MM-DD)")
|
|
58
|
+
.option("--tag <tag>", "Filter by tag")
|
|
59
|
+
.option("--fuzzy", "Enable fuzzy matching")
|
|
60
|
+
.option("--limit <n>", "Limit number of results")
|
|
59
61
|
.action(memorySearchCommand);
|
|
60
62
|
// awp artifact
|
|
61
|
-
const artifact = program
|
|
62
|
-
.command("artifact")
|
|
63
|
-
.description("Knowledge artifact operations (SMP)");
|
|
63
|
+
const artifact = program.command("artifact").description("Knowledge artifact operations (SMP)");
|
|
64
64
|
artifact
|
|
65
65
|
.command("create")
|
|
66
66
|
.description("Create a new knowledge artifact")
|
|
@@ -93,10 +93,188 @@ artifact
|
|
|
93
93
|
.action(artifactSearchCommand);
|
|
94
94
|
artifact
|
|
95
95
|
.command("merge")
|
|
96
|
-
.description("Merge source artifact into target
|
|
96
|
+
.description("Merge source artifact into target")
|
|
97
97
|
.argument("<target>", "Target artifact slug")
|
|
98
98
|
.argument("<source>", "Source artifact slug")
|
|
99
99
|
.option("-m, --message <message>", "Merge message")
|
|
100
|
+
.option("-s, --strategy <strategy>", "Merge strategy (additive, authority)", "additive")
|
|
100
101
|
.action(artifactMergeCommand);
|
|
102
|
+
// awp reputation
|
|
103
|
+
const reputation = program
|
|
104
|
+
.command("reputation")
|
|
105
|
+
.description("Reputation tracking operations (RDP)");
|
|
106
|
+
reputation
|
|
107
|
+
.command("query")
|
|
108
|
+
.description("Query an agent's reputation profile")
|
|
109
|
+
.argument("[slug]", "Agent reputation slug (omit to list all)")
|
|
110
|
+
.option("-d, --dimension <dim>", "Filter by dimension")
|
|
111
|
+
.option("--domain <domain>", "Filter by domain competence")
|
|
112
|
+
.option("--raw", "Show raw scores without decay")
|
|
113
|
+
.action(reputationQueryCommand);
|
|
114
|
+
reputation
|
|
115
|
+
.command("signal")
|
|
116
|
+
.description("Log a reputation signal for an agent")
|
|
117
|
+
.argument("<slug>", "Agent reputation slug")
|
|
118
|
+
.requiredOption("--dimension <dim>", "Dimension (reliability, epistemic-hygiene, coordination, domain-competence)")
|
|
119
|
+
.requiredOption("--score <n>", "Score (0.0-1.0)")
|
|
120
|
+
.option("--domain <domain>", "Domain (required for domain-competence)")
|
|
121
|
+
.option("--evidence <ref>", "Evidence reference (e.g., contract:slug, artifact:slug)")
|
|
122
|
+
.option("--message <msg>", "Human-readable note")
|
|
123
|
+
.option("--agent-did <did>", "Agent DID (required for first signal)")
|
|
124
|
+
.option("--agent-name <name>", "Agent name (required for first signal)")
|
|
125
|
+
.action(reputationSignalCommand);
|
|
126
|
+
reputation.command("list").description("List all tracked agents").action(reputationListCommand);
|
|
127
|
+
// awp contract
|
|
128
|
+
const contract = program.command("contract").description("Delegation contract operations (RDP)");
|
|
129
|
+
contract
|
|
130
|
+
.command("create")
|
|
131
|
+
.description("Create a new delegation contract")
|
|
132
|
+
.argument("<slug>", "Contract slug")
|
|
133
|
+
.requiredOption("--delegate <did>", "Delegate agent DID")
|
|
134
|
+
.requiredOption("--delegate-slug <slug>", "Delegate reputation profile slug")
|
|
135
|
+
.requiredOption("--description <text>", "Task description")
|
|
136
|
+
.option("--delegator <did>", "Delegator DID (defaults to workspace agent)")
|
|
137
|
+
.option("--deadline <date>", "Deadline (ISO 8601)")
|
|
138
|
+
.option("--output-format <type>", "Expected output type")
|
|
139
|
+
.option("--output-slug <slug>", "Expected output artifact slug")
|
|
140
|
+
.action(contractCreateCommand);
|
|
141
|
+
contract
|
|
142
|
+
.command("list")
|
|
143
|
+
.description("List all contracts")
|
|
144
|
+
.option("--status <state>", "Filter by status (draft, active, completed, evaluated)")
|
|
145
|
+
.action(contractListCommand);
|
|
146
|
+
contract
|
|
147
|
+
.command("show")
|
|
148
|
+
.description("Show contract details")
|
|
149
|
+
.argument("<slug>", "Contract slug")
|
|
150
|
+
.action(contractShowCommand);
|
|
151
|
+
contract
|
|
152
|
+
.command("evaluate")
|
|
153
|
+
.description("Evaluate a contract and generate reputation signals")
|
|
154
|
+
.argument("<slug>", "Contract slug")
|
|
155
|
+
.option("--completeness <n>", "Completeness score (0.0-1.0)")
|
|
156
|
+
.option("--accuracy <n>", "Accuracy score (0.0-1.0)")
|
|
157
|
+
.option("--clarity <n>", "Clarity score (0.0-1.0)")
|
|
158
|
+
.option("--timeliness <n>", "Timeliness score (0.0-1.0)")
|
|
159
|
+
.action(contractEvaluateCommand);
|
|
160
|
+
// awp project
|
|
161
|
+
const project = program.command("project").description("Project coordination operations (CDP)");
|
|
162
|
+
project
|
|
163
|
+
.command("create")
|
|
164
|
+
.description("Create a new project")
|
|
165
|
+
.argument("<slug>", "Project slug (e.g., q3-product-launch)")
|
|
166
|
+
.option("-t, --title <title>", "Project title")
|
|
167
|
+
.option("--deadline <date>", "Deadline (ISO 8601 date or YYYY-MM-DD)")
|
|
168
|
+
.option("--tags <tags>", "Comma-separated tags")
|
|
169
|
+
.action(projectCreateCommand);
|
|
170
|
+
project
|
|
171
|
+
.command("list")
|
|
172
|
+
.description("List all projects")
|
|
173
|
+
.option("--status <state>", "Filter by status (draft, active, paused, completed, archived)")
|
|
174
|
+
.action(projectListCommand);
|
|
175
|
+
project
|
|
176
|
+
.command("show")
|
|
177
|
+
.description("Show project details with task summary")
|
|
178
|
+
.argument("<slug>", "Project slug")
|
|
179
|
+
.action(projectShowCommand);
|
|
180
|
+
project
|
|
181
|
+
.command("close")
|
|
182
|
+
.description("Mark a project as completed")
|
|
183
|
+
.argument("<slug>", "Project slug")
|
|
184
|
+
.action(projectCloseCommand);
|
|
185
|
+
// awp task
|
|
186
|
+
const task = program.command("task").description("Task management operations (CDP)");
|
|
187
|
+
task
|
|
188
|
+
.command("create")
|
|
189
|
+
.description("Create a task within a project")
|
|
190
|
+
.argument("<project>", "Project slug")
|
|
191
|
+
.argument("<slug>", "Task slug")
|
|
192
|
+
.option("-t, --title <title>", "Task title")
|
|
193
|
+
.option("--assignee <did>", "Assignee agent DID")
|
|
194
|
+
.option("--assignee-slug <slug>", "Assignee reputation profile slug")
|
|
195
|
+
.option("--priority <level>", "Priority (low, medium, high, critical)", "medium")
|
|
196
|
+
.option("--deadline <date>", "Deadline (ISO 8601 date or YYYY-MM-DD)")
|
|
197
|
+
.option("--blocked-by <ids>", "Comma-separated task IDs that block this task")
|
|
198
|
+
.option("--output-artifact <slug>", "Output artifact slug")
|
|
199
|
+
.option("--contract <slug>", "Associated contract slug")
|
|
200
|
+
.action(taskCreateCommand);
|
|
201
|
+
task
|
|
202
|
+
.command("list")
|
|
203
|
+
.description("List tasks for a project")
|
|
204
|
+
.argument("<project>", "Project slug")
|
|
205
|
+
.option("--status <state>", "Filter by status")
|
|
206
|
+
.option("--assignee <slug>", "Filter by assignee slug")
|
|
207
|
+
.action(taskListCommand);
|
|
208
|
+
task
|
|
209
|
+
.command("update")
|
|
210
|
+
.description("Update a task's status or assignee")
|
|
211
|
+
.argument("<project>", "Project slug")
|
|
212
|
+
.argument("<slug>", "Task slug")
|
|
213
|
+
.option("--status <state>", "New status (pending, in-progress, blocked, review, completed, cancelled)")
|
|
214
|
+
.option("--assignee <did>", "New assignee DID")
|
|
215
|
+
.option("--assignee-slug <slug>", "New assignee reputation profile slug")
|
|
216
|
+
.action(taskUpdateCommand);
|
|
217
|
+
task
|
|
218
|
+
.command("show")
|
|
219
|
+
.description("Show task details")
|
|
220
|
+
.argument("<project>", "Project slug")
|
|
221
|
+
.argument("<slug>", "Task slug")
|
|
222
|
+
.action(taskShowCommand);
|
|
223
|
+
task
|
|
224
|
+
.command("graph")
|
|
225
|
+
.description("Analyze task dependencies: topological order, cycles, critical path")
|
|
226
|
+
.argument("<project>", "Project slug")
|
|
227
|
+
.option("--check", "Check for cycles only (exit with error if found)")
|
|
228
|
+
.option("--json", "Output as JSON")
|
|
229
|
+
.action(taskGraphCommand);
|
|
230
|
+
// awp swarm
|
|
231
|
+
const swarm = program.command("swarm").description("Multi-agent swarm operations (CDP)");
|
|
232
|
+
swarm
|
|
233
|
+
.command("create")
|
|
234
|
+
.description("Create a new swarm for multi-agent coordination")
|
|
235
|
+
.argument("<slug>", "Swarm slug (e.g., q3-launch-team)")
|
|
236
|
+
.option("-n, --name <name>", "Swarm name")
|
|
237
|
+
.option("-g, --goal <goal>", "Swarm goal/objective")
|
|
238
|
+
.option("-p, --project <slug>", "Link to a project")
|
|
239
|
+
.option("--human-lead <id>", "Human lead user ID (e.g., user:marc)")
|
|
240
|
+
.option("--veto-power", "Grant human lead veto power")
|
|
241
|
+
.action(swarmCreateCommand);
|
|
242
|
+
swarm
|
|
243
|
+
.command("role")
|
|
244
|
+
.description("Manage swarm roles")
|
|
245
|
+
.command("add")
|
|
246
|
+
.description("Add a role to a swarm")
|
|
247
|
+
.argument("<swarm>", "Swarm slug")
|
|
248
|
+
.argument("<role>", "Role name (e.g., researcher, writer)")
|
|
249
|
+
.option("-c, --count <n>", "Number of agents needed for this role", "1")
|
|
250
|
+
.option("-r, --min-reputation <spec...>", "Minimum reputation (dimension:score or domain-competence:domain:score)")
|
|
251
|
+
.action(swarmRoleAddCommand);
|
|
252
|
+
swarm
|
|
253
|
+
.command("recruit")
|
|
254
|
+
.description("Find and assign qualified agents to swarm roles")
|
|
255
|
+
.argument("<swarm>", "Swarm slug")
|
|
256
|
+
.option("--auto", "Automatically assign best qualified candidates")
|
|
257
|
+
.action(swarmRecruitCommand);
|
|
258
|
+
swarm
|
|
259
|
+
.command("show")
|
|
260
|
+
.description("Show swarm details and staffing")
|
|
261
|
+
.argument("<slug>", "Swarm slug")
|
|
262
|
+
.action(swarmShowCommand);
|
|
263
|
+
swarm
|
|
264
|
+
.command("list")
|
|
265
|
+
.description("List all swarms")
|
|
266
|
+
.option("--status <state>", "Filter by status (recruiting, active, completed, disbanded)")
|
|
267
|
+
.action(swarmListCommand);
|
|
268
|
+
swarm
|
|
269
|
+
.command("update")
|
|
270
|
+
.description("Update swarm status")
|
|
271
|
+
.argument("<slug>", "Swarm slug")
|
|
272
|
+
.option("--status <state>", "New status (recruiting, active, completed, disbanded)")
|
|
273
|
+
.action(swarmUpdateCommand);
|
|
274
|
+
// awp status
|
|
275
|
+
program
|
|
276
|
+
.command("status")
|
|
277
|
+
.description("Rich workspace overview — projects, tasks, reputation, health")
|
|
278
|
+
.action(statusCommand);
|
|
101
279
|
program.parse();
|
|
102
280
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,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;KACnF,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAE9B,aAAa;AACb,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,+DAA+D,CAAC;KAC5E,MAAM,CAAC,aAAa,CAAC,CAAC;AAEzB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/dist/lib/artifact.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { ArtifactFrontmatter } from "@agent-workspace/core";
|
|
2
2
|
import type { WorkspaceFile } from "@agent-workspace/core";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
export declare function validateSlug(slug: string): boolean;
|
|
3
|
+
import { validateSlug, getAgentDid } from "@agent-workspace/utils";
|
|
4
|
+
export { validateSlug, getAgentDid };
|
|
7
5
|
/**
|
|
8
6
|
* Convert a slug to an artifact ID
|
|
9
7
|
*/
|
|
@@ -24,8 +22,4 @@ export declare function loadArtifact(workspaceRoot: string, slug: string): Promi
|
|
|
24
22
|
* List all artifacts in the workspace
|
|
25
23
|
*/
|
|
26
24
|
export declare function listArtifacts(workspaceRoot: string): Promise<WorkspaceFile<ArtifactFrontmatter>[]>;
|
|
27
|
-
/**
|
|
28
|
-
* Get the agent DID from the workspace manifest, or "anonymous" if not set
|
|
29
|
-
*/
|
|
30
|
-
export declare function getAgentDid(workspaceRoot: string): Promise<string>;
|
|
31
25
|
//# sourceMappingURL=artifact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../../src/lib/artifact.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../../src/lib/artifact.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAsB,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGvF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;AAErC;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAG7C;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,aAAa,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAwB/C"}
|
package/dist/lib/artifact.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { readdir } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { ARTIFACTS_DIR } from "@agent-workspace/core";
|
|
4
|
-
import { parseWorkspaceFile } from "
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Validate an artifact slug
|
|
9
|
-
*/
|
|
10
|
-
export function validateSlug(slug) {
|
|
11
|
-
return SLUG_PATTERN.test(slug);
|
|
12
|
-
}
|
|
4
|
+
import { validateSlug, parseWorkspaceFile, getAgentDid } from "@agent-workspace/utils";
|
|
5
|
+
// Re-export from @agent-workspace/utils for backwards compatibility
|
|
6
|
+
export { validateSlug, getAgentDid };
|
|
13
7
|
/**
|
|
14
8
|
* Convert a slug to an artifact ID
|
|
15
9
|
*/
|
|
@@ -62,16 +56,4 @@ export async function listArtifacts(workspaceRoot) {
|
|
|
62
56
|
}
|
|
63
57
|
return artifacts;
|
|
64
58
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Get the agent DID from the workspace manifest, or "anonymous" if not set
|
|
67
|
-
*/
|
|
68
|
-
export async function getAgentDid(workspaceRoot) {
|
|
69
|
-
try {
|
|
70
|
-
const manifest = await loadManifest(workspaceRoot);
|
|
71
|
-
return manifest.agent.did || "anonymous";
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
return "anonymous";
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
59
|
//# sourceMappingURL=artifact.js.map
|
package/dist/lib/artifact.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact.js","sourceRoot":"","sources":["../../src/lib/artifact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"artifact.js","sourceRoot":"","sources":["../../src/lib/artifact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEvF,oEAAoE;AACpE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;AAErC;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,YAAY,IAAI,EAAE,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,EAAU;IACnC,OAAO,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,aAAqB,EAAE,IAAY;IAC5D,OAAO,IAAI,CAAC,aAAa,EAAE,aAAa,EAAE,GAA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1,41 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { validateSlug, idFromSlug, slugFromId, slugToPath } from "./artifact.js";
|
|
3
|
+
describe("artifact utilities", () => {
|
|
4
|
+
describe("validateSlug", () => {
|
|
5
|
+
it("accepts valid lowercase alphanumeric slugs", () => {
|
|
6
|
+
expect(validateSlug("my-artifact")).toBe(true);
|
|
7
|
+
expect(validateSlug("artifact123")).toBe(true);
|
|
8
|
+
expect(validateSlug("a")).toBe(true);
|
|
9
|
+
expect(validateSlug("test-slug-name")).toBe(true);
|
|
10
|
+
});
|
|
11
|
+
it("rejects invalid slugs", () => {
|
|
12
|
+
expect(validateSlug("")).toBe(false);
|
|
13
|
+
expect(validateSlug("MyArtifact")).toBe(false);
|
|
14
|
+
expect(validateSlug("my_artifact")).toBe(false);
|
|
15
|
+
expect(validateSlug("-starts-with-hyphen")).toBe(false);
|
|
16
|
+
expect(validateSlug("has spaces")).toBe(false);
|
|
17
|
+
expect(validateSlug("special!chars")).toBe(false);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
describe("idFromSlug", () => {
|
|
21
|
+
it("converts slug to artifact ID", () => {
|
|
22
|
+
expect(idFromSlug("my-artifact")).toBe("artifact:my-artifact");
|
|
23
|
+
expect(idFromSlug("test")).toBe("artifact:test");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
describe("slugFromId", () => {
|
|
27
|
+
it("extracts slug from artifact ID", () => {
|
|
28
|
+
expect(slugFromId("artifact:my-artifact")).toBe("my-artifact");
|
|
29
|
+
expect(slugFromId("artifact:test")).toBe("test");
|
|
30
|
+
});
|
|
31
|
+
it("handles IDs without prefix", () => {
|
|
32
|
+
expect(slugFromId("plain-slug")).toBe("plain-slug");
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
describe("slugToPath", () => {
|
|
36
|
+
it("generates correct file path", () => {
|
|
37
|
+
expect(slugToPath("/workspace", "my-artifact")).toBe("/workspace/artifacts/my-artifact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L,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DelegationContractFrontmatter, ReputationSignal } from "@agent-workspace/core";
|
|
2
|
+
import type { WorkspaceFile } from "@agent-workspace/core";
|
|
3
|
+
/**
|
|
4
|
+
* Validate a contract slug
|
|
5
|
+
*/
|
|
6
|
+
export declare function validateSlug(slug: string): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Get the file path for a contract slug
|
|
9
|
+
*/
|
|
10
|
+
export declare function slugToContractPath(workspaceRoot: string, slug: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Load a contract by slug
|
|
13
|
+
*/
|
|
14
|
+
export declare function loadContract(workspaceRoot: string, slug: string): Promise<WorkspaceFile<DelegationContractFrontmatter>>;
|
|
15
|
+
/**
|
|
16
|
+
* List all contracts in the workspace
|
|
17
|
+
*/
|
|
18
|
+
export declare function listContracts(workspaceRoot: string): Promise<WorkspaceFile<DelegationContractFrontmatter>[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Evaluate a contract: compute weighted score and generate reputation signals.
|
|
21
|
+
* Returns the weighted score and the generated signals.
|
|
22
|
+
*/
|
|
23
|
+
export declare function evaluateContract(contract: DelegationContractFrontmatter, scores: Record<string, number>, evaluatorDid: string, now?: Date): {
|
|
24
|
+
weightedScore: number;
|
|
25
|
+
signals: ReputationSignal[];
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/lib/contract.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,6BAA6B,EAC7B,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GACX,MAAM,CAER;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC,6BAA6B,CAAC,CAAC,CAGvD;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,aAAa,CAAC,6BAA6B,CAAC,EAAE,CAAC,CA2BzD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,6BAA6B,EACvC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,YAAY,EAAE,MAAM,EACpB,GAAG,GAAE,IAAiB,GACrB;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAAE,CA8BxD"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { readdir } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { CONTRACTS_DIR } from "@agent-workspace/core";
|
|
4
|
+
import { parseWorkspaceFile } from "./frontmatter.js";
|
|
5
|
+
const SLUG_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
|
|
6
|
+
/**
|
|
7
|
+
* Validate a contract slug
|
|
8
|
+
*/
|
|
9
|
+
export function validateSlug(slug) {
|
|
10
|
+
return SLUG_PATTERN.test(slug);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get the file path for a contract slug
|
|
14
|
+
*/
|
|
15
|
+
export function slugToContractPath(workspaceRoot, slug) {
|
|
16
|
+
return join(workspaceRoot, CONTRACTS_DIR, `${slug}.md`);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Load a contract by slug
|
|
20
|
+
*/
|
|
21
|
+
export async function loadContract(workspaceRoot, slug) {
|
|
22
|
+
const filePath = slugToContractPath(workspaceRoot, slug);
|
|
23
|
+
return parseWorkspaceFile(filePath);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* List all contracts in the workspace
|
|
27
|
+
*/
|
|
28
|
+
export async function listContracts(workspaceRoot) {
|
|
29
|
+
const contractsDir = join(workspaceRoot, CONTRACTS_DIR);
|
|
30
|
+
let files;
|
|
31
|
+
try {
|
|
32
|
+
files = await readdir(contractsDir);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
const mdFiles = files.filter((f) => f.endsWith(".md")).sort();
|
|
38
|
+
const contracts = [];
|
|
39
|
+
for (const f of mdFiles) {
|
|
40
|
+
try {
|
|
41
|
+
const parsed = await parseWorkspaceFile(join(contractsDir, f));
|
|
42
|
+
if (parsed.frontmatter.type === "delegation-contract") {
|
|
43
|
+
contracts.push(parsed);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// Skip unparseable files
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return contracts;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Evaluate a contract: compute weighted score and generate reputation signals.
|
|
54
|
+
* Returns the weighted score and the generated signals.
|
|
55
|
+
*/
|
|
56
|
+
export function evaluateContract(contract, scores, evaluatorDid, now = new Date()) {
|
|
57
|
+
const { criteria } = contract.evaluation;
|
|
58
|
+
// Compute weighted score
|
|
59
|
+
let weightedScore = 0;
|
|
60
|
+
for (const [criterion, weight] of Object.entries(criteria)) {
|
|
61
|
+
const score = scores[criterion];
|
|
62
|
+
if (score === undefined) {
|
|
63
|
+
throw new Error(`Missing score for criterion: ${criterion}`);
|
|
64
|
+
}
|
|
65
|
+
weightedScore += weight * score;
|
|
66
|
+
}
|
|
67
|
+
weightedScore = Math.round(weightedScore * 1000) / 1000;
|
|
68
|
+
const timestamp = now.toISOString();
|
|
69
|
+
const evidence = contract.id;
|
|
70
|
+
// Generate reputation signals
|
|
71
|
+
const signals = [
|
|
72
|
+
{
|
|
73
|
+
source: evaluatorDid,
|
|
74
|
+
dimension: "reliability",
|
|
75
|
+
score: weightedScore,
|
|
76
|
+
timestamp,
|
|
77
|
+
evidence,
|
|
78
|
+
message: `Contract evaluation: ${contract.task.description}`,
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
return { weightedScore, signals };
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/lib/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAKtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,aAAqB,EACrB,IAAY;IAEZ,OAAO,IAAI,CAAC,aAAa,EAAE,aAAa,EAAE,GAAG,IAAI,KAAK,CAAC,CAAC;AAC1D,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,aAAqB,EACrB,IAAY;IAEZ,MAAM,QAAQ,GAAG,kBAAkB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IACzD,OAAO,kBAAkB,CAAgC,QAAQ,CAAC,CAAC;AACrE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,aAAqB;IAErB,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IACxD,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aAAa,IAAI,MAAM,GAAG,KAAK,CAAC;IAClC,CAAC;IACD,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAExD,MAAM,SAAS,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IACpC,MAAM,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAC;IAE7B,8BAA8B;IAC9B,MAAM,OAAO,GAAuB;QAClC;YACE,MAAM,EAAE,YAAY;YACpB,SAAS,EAAE,aAAa;YACxB,KAAK,EAAE,aAAa;YACpB,SAAS;YACT,QAAQ;YACR,OAAO,EAAE,wBAAwB,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE;SAC7D;KACF,CAAC;IAEF,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import type { BaseFrontmatter, WorkspaceFile } from "@agent-workspace/core";
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* Re-export frontmatter utilities from @agent-workspace/utils
|
|
4
3
|
*/
|
|
5
|
-
export
|
|
6
|
-
/**
|
|
7
|
-
* Serialize a workspace file back to dual-format (YAML frontmatter + Markdown body)
|
|
8
|
-
*/
|
|
9
|
-
export declare function serializeWorkspaceFile<T extends BaseFrontmatter>(file: WorkspaceFile<T>): string;
|
|
10
|
-
/**
|
|
11
|
-
* Write a workspace file to disk
|
|
12
|
-
*/
|
|
13
|
-
export declare function writeWorkspaceFile<T extends BaseFrontmatter>(file: WorkspaceFile<T>): Promise<void>;
|
|
4
|
+
export { parseWorkspaceFile, serializeWorkspaceFile, writeWorkspaceFile, getFrontmatterType, } from "@agent-workspace/utils";
|
|
14
5
|
/**
|
|
15
6
|
* Check if a file has valid AWP frontmatter (has awp + type fields)
|
|
16
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/lib/frontmatter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/lib/frontmatter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAExE"}
|
package/dist/lib/frontmatter.js
CHANGED
|
@@ -1,30 +1,7 @@
|
|
|
1
|
-
import matter from "gray-matter";
|
|
2
|
-
import { readFile, writeFile } from "node:fs/promises";
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
2
|
+
* Re-export frontmatter utilities from @agent-workspace/utils
|
|
5
3
|
*/
|
|
6
|
-
export
|
|
7
|
-
const raw = await readFile(filePath, "utf-8");
|
|
8
|
-
const { data, content } = matter(raw);
|
|
9
|
-
return {
|
|
10
|
-
frontmatter: data,
|
|
11
|
-
body: content,
|
|
12
|
-
filePath,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Serialize a workspace file back to dual-format (YAML frontmatter + Markdown body)
|
|
17
|
-
*/
|
|
18
|
-
export function serializeWorkspaceFile(file) {
|
|
19
|
-
return matter.stringify(file.body, file.frontmatter);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Write a workspace file to disk
|
|
23
|
-
*/
|
|
24
|
-
export async function writeWorkspaceFile(file) {
|
|
25
|
-
const content = serializeWorkspaceFile(file);
|
|
26
|
-
await writeFile(file.filePath, content, "utf-8");
|
|
27
|
-
}
|
|
4
|
+
export { parseWorkspaceFile, serializeWorkspaceFile, writeWorkspaceFile, getFrontmatterType, } from "@agent-workspace/utils";
|
|
28
5
|
/**
|
|
29
6
|
* Check if a file has valid AWP frontmatter (has awp + type fields)
|
|
30
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/lib/frontmatter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/lib/frontmatter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAA6B;IAC7D,OAAO,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;AACvE,CAAC"}
|