@kynver-app/openclaw-agent-os 0.1.13 → 0.1.15
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/README.md +41 -1
- package/dist/index.js +552 -5
- package/dist/index.js.map +3 -3
- package/openclaw.plugin.json +14 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -372,6 +372,12 @@ function directRequestForTool(toolName, params, resolvedSlug) {
|
|
|
372
372
|
switch (toolName) {
|
|
373
373
|
case "agent_os_get_context":
|
|
374
374
|
return { slug, method: "GET", path: "/stats" };
|
|
375
|
+
case "agent_os_context_envelope":
|
|
376
|
+
return {
|
|
377
|
+
slug,
|
|
378
|
+
method: "GET",
|
|
379
|
+
path: "/context-envelope" + queryString(params, ["anchorType", "anchorId", "memoryQuery", "memoryLimit", "sessionLimit"])
|
|
380
|
+
};
|
|
375
381
|
case "agent_os_open_session":
|
|
376
382
|
return { slug, method: "POST", path: "/sessions", body: withoutSlug };
|
|
377
383
|
case "agent_os_close_session": {
|
|
@@ -407,7 +413,19 @@ function directRequestForTool(toolName, params, resolvedSlug) {
|
|
|
407
413
|
}
|
|
408
414
|
case "agent_os_search_memory": {
|
|
409
415
|
const q = requiredString(params.query, "query");
|
|
410
|
-
return {
|
|
416
|
+
return {
|
|
417
|
+
slug,
|
|
418
|
+
method: "GET",
|
|
419
|
+
path: `/memory?${queryStringFromEntries({ q, k: params.k, ticker: params.ticker, debatePersona: params.debatePersona })}`
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
case "agent_os_get_desk_debate_context": {
|
|
423
|
+
const ticker = requiredString(params.ticker, "ticker");
|
|
424
|
+
return {
|
|
425
|
+
slug,
|
|
426
|
+
method: "GET",
|
|
427
|
+
path: `/desk-debate-context?${queryStringFromEntries({ ticker, reportId: params.reportId })}`
|
|
428
|
+
};
|
|
411
429
|
}
|
|
412
430
|
case "agent_os_list_skills":
|
|
413
431
|
return { slug, method: "GET", path: "/skills" + queryString(params, ["view"]) };
|
|
@@ -510,8 +528,18 @@ function directRequestForTool(toolName, params, resolvedSlug) {
|
|
|
510
528
|
const contactId = requiredString(params.contactId, "contactId");
|
|
511
529
|
return { slug, method: "PATCH", path: `/contacts/${encodeURIComponent(contactId)}`, body: stripKeys(params, ["slug", "contactId"]) };
|
|
512
530
|
}
|
|
531
|
+
case "agent_os_correct_memory":
|
|
532
|
+
return { slug, method: "POST", path: "/memory/correct", body: withoutSlug };
|
|
513
533
|
case "agent_os_consolidate_memory":
|
|
514
534
|
return { slug, method: "POST", path: "/consolidate", body: {} };
|
|
535
|
+
case "agent_os_record_state":
|
|
536
|
+
return { slug, method: "POST", path: "/memory/state", body: withoutSlug };
|
|
537
|
+
case "agent_os_get_state":
|
|
538
|
+
return {
|
|
539
|
+
slug,
|
|
540
|
+
method: "GET",
|
|
541
|
+
path: `/memory/state${queryString(params, ["entityKey", "entityType", "projectId", "limit"])}`
|
|
542
|
+
};
|
|
515
543
|
case "agent_os_task_create":
|
|
516
544
|
return { slug, method: "POST", path: "/tasks", body: withoutSlug };
|
|
517
545
|
case "agent_os_task_get": {
|
|
@@ -548,10 +576,83 @@ function directRequestForTool(toolName, params, resolvedSlug) {
|
|
|
548
576
|
const taskId = requiredString(params.taskId, "taskId");
|
|
549
577
|
return { slug, method: "POST", path: `/tasks/${encodeURIComponent(taskId)}/renew-lease`, body: stripKeys(params, ["slug", "taskId"]) };
|
|
550
578
|
}
|
|
579
|
+
case "agent_os_plan_create": {
|
|
580
|
+
const body = renamePlanSlug(stripKeys(params, ["slug"]));
|
|
581
|
+
return { slug, method: "POST", path: "/plans", body };
|
|
582
|
+
}
|
|
583
|
+
case "agent_os_plan_list":
|
|
584
|
+
return {
|
|
585
|
+
slug,
|
|
586
|
+
method: "GET",
|
|
587
|
+
path: `/plans${queryString(params, ["status", "projectId", "goalId", "canonicalKey", "limit"])}`
|
|
588
|
+
};
|
|
589
|
+
case "agent_os_plan_get": {
|
|
590
|
+
const planId = requiredString(params.planId, "planId");
|
|
591
|
+
return { slug, method: "GET", path: `/plans/${encodeURIComponent(planId)}` };
|
|
592
|
+
}
|
|
593
|
+
case "agent_os_plan_update": {
|
|
594
|
+
const planId = requiredString(params.planId, "planId");
|
|
595
|
+
const body = renamePlanSlug(stripKeys(params, ["slug", "planId"]));
|
|
596
|
+
return {
|
|
597
|
+
slug,
|
|
598
|
+
method: "PATCH",
|
|
599
|
+
path: `/plans/${encodeURIComponent(planId)}`,
|
|
600
|
+
body
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
case "agent_os_plan_add_version": {
|
|
604
|
+
const planId = requiredString(params.planId, "planId");
|
|
605
|
+
return {
|
|
606
|
+
slug,
|
|
607
|
+
method: "POST",
|
|
608
|
+
path: `/plans/${encodeURIComponent(planId)}/versions`,
|
|
609
|
+
body: stripKeys(params, ["slug", "planId"])
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
case "agent_os_plan_mark_current": {
|
|
613
|
+
const planId = requiredString(params.planId, "planId");
|
|
614
|
+
const versionId = requiredString(params.versionId, "versionId");
|
|
615
|
+
return {
|
|
616
|
+
slug,
|
|
617
|
+
method: "POST",
|
|
618
|
+
path: `/plans/${encodeURIComponent(planId)}/versions`,
|
|
619
|
+
body: { action: "mark_current", versionId }
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
case "agent_os_plan_list_versions": {
|
|
623
|
+
const planId = requiredString(params.planId, "planId");
|
|
624
|
+
return {
|
|
625
|
+
slug,
|
|
626
|
+
method: "GET",
|
|
627
|
+
path: `/plans/${encodeURIComponent(planId)}/versions`
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
case "agent_os_plan_add_link": {
|
|
631
|
+
const planId = requiredString(params.planId, "planId");
|
|
632
|
+
return {
|
|
633
|
+
slug,
|
|
634
|
+
method: "POST",
|
|
635
|
+
path: `/plans/${encodeURIComponent(planId)}/links`,
|
|
636
|
+
body: stripKeys(params, ["slug", "planId"])
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
case "agent_os_plan_list_links": {
|
|
640
|
+
const planId = requiredString(params.planId, "planId");
|
|
641
|
+
return {
|
|
642
|
+
slug,
|
|
643
|
+
method: "GET",
|
|
644
|
+
path: `/plans/${encodeURIComponent(planId)}/links`
|
|
645
|
+
};
|
|
646
|
+
}
|
|
551
647
|
default:
|
|
552
648
|
throw new Error(`Unsupported AgentOS direct tool: ${toolName}`);
|
|
553
649
|
}
|
|
554
650
|
}
|
|
651
|
+
function renamePlanSlug(body) {
|
|
652
|
+
if (!("planSlug" in body)) return body;
|
|
653
|
+
const { planSlug, ...rest } = body;
|
|
654
|
+
return planSlug === void 0 ? rest : { ...rest, slug: planSlug };
|
|
655
|
+
}
|
|
555
656
|
function requiredString(value, name) {
|
|
556
657
|
const stringValue2 = stringParam(value);
|
|
557
658
|
if (!stringValue2) throw new Error(`${name} is required`);
|
|
@@ -685,6 +786,8 @@ function buildAgentOsContinuityGuidanceContext(config) {
|
|
|
685
786
|
"",
|
|
686
787
|
"On session start or whenever you need user identity, goals, projects, contacts, recent sessions, or memory stats, call agent_os_get_context before answering. Prefer omitting the slug so the account's primary AgentOS workspace resolves automatically.",
|
|
687
788
|
"For recall of prior work, people, preferences, decisions, or follow-ups, call agent_os_search_memory before relying on conversational memory or local files. Use a short natural-language query.",
|
|
789
|
+
"agent_os_search_memory returns hits in three authority-ordered lanes: Lane A operating rules & preferences, Lane B active project state (PR/branch/deployment current truth), then Lane C historical context. Each hit carries a `lane` field. When lanes conflict, prefer a Lane A/B hit over a higher-scored Lane C hit \u2014 semantic similarity is not authority.",
|
|
790
|
+
"Before you answer with any mutable fact \u2014 PR ownership/state/checks, branch freshness, deployment status \u2014 consult the matching Lane B active-state hit. If its `verificationState` is `unverified` or `stale_verification`, or it carries a `laneWarning`, you MUST first re-run the live check (GitHub API/CLI, git, deploy metadata) and answer from that, or else explicitly tell the user the state is unverified/stale and needs a re-check. Never present an unverified or stale active-state fact as current truth, and never let a topically similar historical memory stand in for live state.",
|
|
688
791
|
"When you learn a durable fact, decision, preference, project update, or lesson, persist it: agent_os_write_memory for new entries, agent_os_update_memory for revisions. Include sourceRefs plus memoryType/confidence/reviewStatus when you can; use reviewStatus=needs_review for uncertain or user-correctable memories.",
|
|
689
792
|
"For project/goal status changes, use agent_os_update_project / agent_os_update_goal so the structured record stays in sync with what you write to memory.",
|
|
690
793
|
"Use agent_os_open_session at the start of a substantive session and agent_os_log_session_event for meaningful topics, decisions, files, commits, and follow-ups. Close with agent_os_close_session (or agent_os_log_session for ad-hoc daily-log entries).",
|
|
@@ -954,6 +1057,39 @@ var getContextSchema = {
|
|
|
954
1057
|
additionalProperties: false,
|
|
955
1058
|
$schema: "http://json-schema.org/draft-07/schema#"
|
|
956
1059
|
};
|
|
1060
|
+
var contextEnvelopeSchema = {
|
|
1061
|
+
type: "object",
|
|
1062
|
+
required: ["anchorType", "anchorId"],
|
|
1063
|
+
properties: {
|
|
1064
|
+
anchorType: {
|
|
1065
|
+
type: "string",
|
|
1066
|
+
enum: ["plan", "task", "goal", "project", "session"],
|
|
1067
|
+
description: "Kind of anchor to load context around."
|
|
1068
|
+
},
|
|
1069
|
+
anchorId: {
|
|
1070
|
+
type: "string",
|
|
1071
|
+
description: "Id of the anchor row within this workspace."
|
|
1072
|
+
},
|
|
1073
|
+
memoryQuery: {
|
|
1074
|
+
type: "string",
|
|
1075
|
+
description: "Override the memory search query. Defaults to a query derived from the anchor's title/summary."
|
|
1076
|
+
},
|
|
1077
|
+
memoryLimit: {
|
|
1078
|
+
type: "number",
|
|
1079
|
+
description: "Max memory hits (default 5, max 20). Set 0 to skip memory recall."
|
|
1080
|
+
},
|
|
1081
|
+
sessionLimit: {
|
|
1082
|
+
type: "number",
|
|
1083
|
+
description: "Max recent sessions (default 1, max 5). Set 0 to skip."
|
|
1084
|
+
},
|
|
1085
|
+
slug: {
|
|
1086
|
+
type: "string",
|
|
1087
|
+
description: "AgentOS slug. Omit to use the account's primary AgentOS workspace."
|
|
1088
|
+
}
|
|
1089
|
+
},
|
|
1090
|
+
additionalProperties: false,
|
|
1091
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
1092
|
+
};
|
|
957
1093
|
|
|
958
1094
|
// src/tools/context.ts
|
|
959
1095
|
function createContextTools(config) {
|
|
@@ -974,6 +1110,23 @@ function createContextTools(config) {
|
|
|
974
1110
|
agentOsSlug: config.agentOsSlug,
|
|
975
1111
|
enableDirectHttp: config.enableDirectHttp
|
|
976
1112
|
})
|
|
1113
|
+
},
|
|
1114
|
+
{
|
|
1115
|
+
name: "agent_os_context_envelope",
|
|
1116
|
+
label: "AgentOS Context Envelope",
|
|
1117
|
+
description: "Compact context envelope for one anchor (plan | task | goal | project | session): the resolved anchor, its goal + current plan version + most-relevant task + recent session + top related memories, with deduplicated source refs. Use instead of reading giant docs.",
|
|
1118
|
+
parameters: contextEnvelopeSchema,
|
|
1119
|
+
execute: (_toolCallId, params) => callAgentOsTool({
|
|
1120
|
+
serverName: config.agentOsServer,
|
|
1121
|
+
toolName: "agent_os_context_envelope",
|
|
1122
|
+
params,
|
|
1123
|
+
timeoutMs: config.timeoutMs,
|
|
1124
|
+
mcporterConfigPath: config.mcporterConfigPath,
|
|
1125
|
+
kynverApiUrl: config.kynverApiUrl,
|
|
1126
|
+
kynverApiKey: config.kynverApiKey,
|
|
1127
|
+
agentOsSlug: config.agentOsSlug,
|
|
1128
|
+
enableDirectHttp: config.enableDirectHttp
|
|
1129
|
+
})
|
|
977
1130
|
}
|
|
978
1131
|
];
|
|
979
1132
|
}
|
|
@@ -1109,7 +1262,15 @@ var searchMemorySchema = {
|
|
|
1109
1262
|
properties: {
|
|
1110
1263
|
query: { type: "string" },
|
|
1111
1264
|
k: { type: "number" },
|
|
1112
|
-
slug: { type: "string" }
|
|
1265
|
+
slug: { type: "string" },
|
|
1266
|
+
projectId: {
|
|
1267
|
+
type: "string",
|
|
1268
|
+
description: "Scope Lane B (active project state) results to a single project."
|
|
1269
|
+
},
|
|
1270
|
+
groupByLane: {
|
|
1271
|
+
type: "boolean",
|
|
1272
|
+
description: "When true, also return a `lanes` object grouping hits into operating / activeState / historical. The flat `items` array is always returned regardless."
|
|
1273
|
+
}
|
|
1113
1274
|
},
|
|
1114
1275
|
required: ["query"],
|
|
1115
1276
|
additionalProperties: false,
|
|
@@ -1164,6 +1325,46 @@ var updateMemorySchema = {
|
|
|
1164
1325
|
additionalProperties: false,
|
|
1165
1326
|
$schema: "http://json-schema.org/draft-07/schema#"
|
|
1166
1327
|
};
|
|
1328
|
+
var correctMemorySchema = {
|
|
1329
|
+
type: "object",
|
|
1330
|
+
properties: {
|
|
1331
|
+
targetSlug: {
|
|
1332
|
+
type: "string",
|
|
1333
|
+
description: "Slug of the stale or wrong memory being corrected."
|
|
1334
|
+
},
|
|
1335
|
+
content: {
|
|
1336
|
+
type: "string",
|
|
1337
|
+
description: "The corrected, true content for the new correction memory."
|
|
1338
|
+
},
|
|
1339
|
+
reason: {
|
|
1340
|
+
type: "string",
|
|
1341
|
+
description: "Why the target is wrong \u2014 recorded on it as supersededReason."
|
|
1342
|
+
},
|
|
1343
|
+
key: {
|
|
1344
|
+
type: "string",
|
|
1345
|
+
description: "Slug for the new correction memory. Defaults to `<targetSlug>-correction`."
|
|
1346
|
+
},
|
|
1347
|
+
alsoInvalidates: {
|
|
1348
|
+
type: "array",
|
|
1349
|
+
items: { type: "string" },
|
|
1350
|
+
description: "Additional memory slugs/ids to supersede alongside targetSlug."
|
|
1351
|
+
},
|
|
1352
|
+
assertedBySessionId: { type: "string" },
|
|
1353
|
+
sourceId: { type: "string" },
|
|
1354
|
+
sourceRefs,
|
|
1355
|
+
memoryType,
|
|
1356
|
+
confidence,
|
|
1357
|
+
reviewStatus,
|
|
1358
|
+
projectId: { type: "string" },
|
|
1359
|
+
goalId: { type: "string" },
|
|
1360
|
+
contactId: { type: "string" },
|
|
1361
|
+
skillId: { type: "string" },
|
|
1362
|
+
slug: { type: "string" }
|
|
1363
|
+
},
|
|
1364
|
+
required: ["targetSlug", "content", "reason"],
|
|
1365
|
+
additionalProperties: false,
|
|
1366
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
1367
|
+
};
|
|
1167
1368
|
var consolidateMemorySchema = {
|
|
1168
1369
|
type: "object",
|
|
1169
1370
|
properties: {
|
|
@@ -1172,6 +1373,52 @@ var consolidateMemorySchema = {
|
|
|
1172
1373
|
additionalProperties: false,
|
|
1173
1374
|
$schema: "http://json-schema.org/draft-07/schema#"
|
|
1174
1375
|
};
|
|
1376
|
+
var activeStateEntityTypeValues = ["pr_watch", "branch", "deployment"];
|
|
1377
|
+
var activeStateEntityType = {
|
|
1378
|
+
type: "string",
|
|
1379
|
+
enum: activeStateEntityTypeValues,
|
|
1380
|
+
description: "Tracked entity kind. pr_watch: a live PR. branch: local-vs-remote branch state. deployment: a live release."
|
|
1381
|
+
};
|
|
1382
|
+
var recordStateSchema = {
|
|
1383
|
+
type: "object",
|
|
1384
|
+
properties: {
|
|
1385
|
+
entityType: activeStateEntityType,
|
|
1386
|
+
fields: {
|
|
1387
|
+
type: "object",
|
|
1388
|
+
additionalProperties: true,
|
|
1389
|
+
description: "Entity-specific current truth. pr_watch requires repo, pr, author, headOwner, headBranch, state (optional checks, blocker). branch requires repo, branch, aheadBy, behindBy, lastCommit. deployment requires target, env, state, url and at least one of version/sha. The canonical entityKey is derived server-side from these fields \u2014 do not pass it."
|
|
1390
|
+
},
|
|
1391
|
+
observedAt: {
|
|
1392
|
+
type: "string",
|
|
1393
|
+
description: "ISO timestamp the state was observed. Defaults to now."
|
|
1394
|
+
},
|
|
1395
|
+
content: { type: "string", description: "Optional human summary; one is generated otherwise." },
|
|
1396
|
+
sourceRefs,
|
|
1397
|
+
projectId: { type: "string" },
|
|
1398
|
+
confidence,
|
|
1399
|
+
reviewStatus,
|
|
1400
|
+
metadata: looseObject,
|
|
1401
|
+
slug: { type: "string" }
|
|
1402
|
+
},
|
|
1403
|
+
required: ["entityType", "fields"],
|
|
1404
|
+
additionalProperties: false,
|
|
1405
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
1406
|
+
};
|
|
1407
|
+
var getStateSchema = {
|
|
1408
|
+
type: "object",
|
|
1409
|
+
properties: {
|
|
1410
|
+
entityKey: {
|
|
1411
|
+
type: "string",
|
|
1412
|
+
description: "Canonical key of a single record, e.g. pr:openclaw/openclaw#83529. Omit to list records."
|
|
1413
|
+
},
|
|
1414
|
+
entityType: activeStateEntityType,
|
|
1415
|
+
projectId: { type: "string" },
|
|
1416
|
+
limit: { type: "number" },
|
|
1417
|
+
slug: { type: "string" }
|
|
1418
|
+
},
|
|
1419
|
+
additionalProperties: false,
|
|
1420
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
1421
|
+
};
|
|
1175
1422
|
|
|
1176
1423
|
// src/tools/memory.ts
|
|
1177
1424
|
function createMemoryTools(config) {
|
|
@@ -1193,7 +1440,11 @@ function createMemoryTools(config) {
|
|
|
1193
1440
|
})
|
|
1194
1441
|
});
|
|
1195
1442
|
return [
|
|
1196
|
-
mk(
|
|
1443
|
+
mk(
|
|
1444
|
+
"agent_os_search_memory",
|
|
1445
|
+
"Search AgentOS memory. Results are ordered by authority across three lanes: Lane A operating rules & preferences, Lane B active project state (PR/branch/deployment current truth), then Lane C historical context via semantic + keyword hybrid recall. Each hit carries a `lane` field plus `verificationState` and `laneWarning` \u2014 re-check or disclose any unverified/stale Lane B fact before answering with it.",
|
|
1446
|
+
searchMemorySchema
|
|
1447
|
+
),
|
|
1197
1448
|
mk(
|
|
1198
1449
|
"agent_os_write_memory",
|
|
1199
1450
|
"Write durable AgentOS memory for facts, decisions, lessons, preferences, source maps, and runbooks. Prefer session event/log tools for ordinary progress; include sourceRefs plus memoryType/confidence/reviewStatus when possible.",
|
|
@@ -1204,7 +1455,302 @@ function createMemoryTools(config) {
|
|
|
1204
1455
|
"Update an existing AgentOS memory entry by key, preserving or improving sourceRefs and writer-contract fields for auditability.",
|
|
1205
1456
|
updateMemorySchema
|
|
1206
1457
|
),
|
|
1207
|
-
mk(
|
|
1458
|
+
mk(
|
|
1459
|
+
"agent_os_correct_memory",
|
|
1460
|
+
"Correct a stale or wrong AgentOS memory. Writes a new `correction` memory carrying a machine-readable claim that atomically supersedes the named target (and any `alsoInvalidates` entries) \u2014 the auditable, recoverable way to fix a misremembered fact. Prefer this over editing in place when the prior memory was substantively wrong.",
|
|
1461
|
+
correctMemorySchema
|
|
1462
|
+
),
|
|
1463
|
+
mk("agent_os_consolidate_memory", "Trigger an AgentOS memory consolidation pass.", consolidateMemorySchema),
|
|
1464
|
+
mk(
|
|
1465
|
+
"agent_os_record_state",
|
|
1466
|
+
"Upsert an AgentOS active-state record \u2014 the live truth for one tracked entity (a PR, a branch, a deployment). One row per entity, replaced in place. Use this for volatile facts (PR ownership/state, branch freshness, deployment status) instead of writing them as ordinary memory.",
|
|
1467
|
+
recordStateSchema
|
|
1468
|
+
),
|
|
1469
|
+
mk(
|
|
1470
|
+
"agent_os_get_state",
|
|
1471
|
+
"Read AgentOS active-state records. Pass entityKey for a single tracked entity, or omit it to list current state (optionally filtered by entityType/projectId). Use this to answer 'what is true right now?' before relying on a volatile fact.",
|
|
1472
|
+
getStateSchema
|
|
1473
|
+
)
|
|
1474
|
+
];
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
// src/schemas/plans.ts
|
|
1478
|
+
var planStatusValues = [
|
|
1479
|
+
"draft",
|
|
1480
|
+
"active",
|
|
1481
|
+
"blocked",
|
|
1482
|
+
"complete",
|
|
1483
|
+
"archived",
|
|
1484
|
+
"superseded"
|
|
1485
|
+
];
|
|
1486
|
+
var planPriorityValues = ["low", "normal", "high", "critical"];
|
|
1487
|
+
var planLinkTargetValues = [
|
|
1488
|
+
"goal",
|
|
1489
|
+
"project",
|
|
1490
|
+
"task",
|
|
1491
|
+
"memory",
|
|
1492
|
+
"session",
|
|
1493
|
+
"repo",
|
|
1494
|
+
"branch",
|
|
1495
|
+
"commit",
|
|
1496
|
+
"pr",
|
|
1497
|
+
"url",
|
|
1498
|
+
"markdown",
|
|
1499
|
+
"plan"
|
|
1500
|
+
];
|
|
1501
|
+
var planStatus = { type: "string", enum: planStatusValues };
|
|
1502
|
+
var planPriority = { type: "string", enum: planPriorityValues };
|
|
1503
|
+
var planLinkTarget = { type: "string", enum: planLinkTargetValues };
|
|
1504
|
+
var initialVersion = {
|
|
1505
|
+
type: "object",
|
|
1506
|
+
properties: {
|
|
1507
|
+
title: { type: "string" },
|
|
1508
|
+
body: { type: "string", description: "Full plan body (markdown)." },
|
|
1509
|
+
summary: { type: "string" },
|
|
1510
|
+
changeSummary: { type: "string" },
|
|
1511
|
+
author: { type: "string" },
|
|
1512
|
+
sourceRefs: {},
|
|
1513
|
+
metadata: looseObject
|
|
1514
|
+
},
|
|
1515
|
+
required: ["body"],
|
|
1516
|
+
additionalProperties: false
|
|
1517
|
+
};
|
|
1518
|
+
var planCreateSchema = {
|
|
1519
|
+
type: "object",
|
|
1520
|
+
properties: {
|
|
1521
|
+
title: { type: "string", description: "Human-readable plan title." },
|
|
1522
|
+
summary: { type: "string" },
|
|
1523
|
+
planSlug: {
|
|
1524
|
+
type: "string",
|
|
1525
|
+
description: "Optional stable slug for the plan within the AgentOS workspace."
|
|
1526
|
+
},
|
|
1527
|
+
status: planStatus,
|
|
1528
|
+
priority: planPriority,
|
|
1529
|
+
owner: { type: "string" },
|
|
1530
|
+
projectId: {
|
|
1531
|
+
type: "string",
|
|
1532
|
+
description: "AgentOS project id this plan belongs to."
|
|
1533
|
+
},
|
|
1534
|
+
goalId: {
|
|
1535
|
+
type: "string",
|
|
1536
|
+
description: "AgentOS goal id this plan supports."
|
|
1537
|
+
},
|
|
1538
|
+
canonicalKey: {
|
|
1539
|
+
type: "string",
|
|
1540
|
+
description: "Optional canonical key for deduping plans that describe the same artifact."
|
|
1541
|
+
},
|
|
1542
|
+
metadata: looseObject,
|
|
1543
|
+
sourceRefs: {},
|
|
1544
|
+
initialVersion: {
|
|
1545
|
+
...initialVersion,
|
|
1546
|
+
description: "First version snapshot (required). Becomes the plan's current version."
|
|
1547
|
+
},
|
|
1548
|
+
slug: {
|
|
1549
|
+
type: "string",
|
|
1550
|
+
description: "AgentOS workspace slug. Omit to use the primary workspace."
|
|
1551
|
+
}
|
|
1552
|
+
},
|
|
1553
|
+
required: ["title", "initialVersion"],
|
|
1554
|
+
additionalProperties: false,
|
|
1555
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
1556
|
+
};
|
|
1557
|
+
var planListSchema = {
|
|
1558
|
+
type: "object",
|
|
1559
|
+
properties: {
|
|
1560
|
+
status: planStatus,
|
|
1561
|
+
projectId: { type: "string" },
|
|
1562
|
+
goalId: { type: "string" },
|
|
1563
|
+
canonicalKey: { type: "string" },
|
|
1564
|
+
limit: { type: "number", description: "Max rows (default 50, max 200)." },
|
|
1565
|
+
slug: { type: "string" }
|
|
1566
|
+
},
|
|
1567
|
+
additionalProperties: false,
|
|
1568
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
1569
|
+
};
|
|
1570
|
+
var planGetSchema = {
|
|
1571
|
+
type: "object",
|
|
1572
|
+
properties: {
|
|
1573
|
+
planId: { type: "string" },
|
|
1574
|
+
slug: { type: "string" }
|
|
1575
|
+
},
|
|
1576
|
+
required: ["planId"],
|
|
1577
|
+
additionalProperties: false,
|
|
1578
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
1579
|
+
};
|
|
1580
|
+
var planUpdateSchema = {
|
|
1581
|
+
type: "object",
|
|
1582
|
+
properties: {
|
|
1583
|
+
planId: { type: "string" },
|
|
1584
|
+
title: { type: "string" },
|
|
1585
|
+
summary: { type: "string" },
|
|
1586
|
+
planSlug: {
|
|
1587
|
+
type: "string",
|
|
1588
|
+
description: "Optional stable slug for the plan within the AgentOS workspace."
|
|
1589
|
+
},
|
|
1590
|
+
status: planStatus,
|
|
1591
|
+
priority: planPriority,
|
|
1592
|
+
owner: { type: "string" },
|
|
1593
|
+
projectId: { type: "string" },
|
|
1594
|
+
goalId: { type: "string" },
|
|
1595
|
+
canonicalKey: { type: "string" },
|
|
1596
|
+
metadata: looseObject,
|
|
1597
|
+
sourceRefs: {},
|
|
1598
|
+
slug: { type: "string" }
|
|
1599
|
+
},
|
|
1600
|
+
required: ["planId"],
|
|
1601
|
+
additionalProperties: false,
|
|
1602
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
1603
|
+
};
|
|
1604
|
+
var planAddVersionSchema = {
|
|
1605
|
+
type: "object",
|
|
1606
|
+
properties: {
|
|
1607
|
+
planId: { type: "string" },
|
|
1608
|
+
title: { type: "string" },
|
|
1609
|
+
body: { type: "string", description: "Full new version body (markdown)." },
|
|
1610
|
+
summary: { type: "string" },
|
|
1611
|
+
changeSummary: { type: "string" },
|
|
1612
|
+
author: { type: "string" },
|
|
1613
|
+
sourceRefs: {},
|
|
1614
|
+
metadata: looseObject,
|
|
1615
|
+
markCurrent: {
|
|
1616
|
+
type: "boolean",
|
|
1617
|
+
description: "When true (default), the new version becomes the plan's current version."
|
|
1618
|
+
},
|
|
1619
|
+
slug: { type: "string" }
|
|
1620
|
+
},
|
|
1621
|
+
required: ["planId", "body"],
|
|
1622
|
+
additionalProperties: false,
|
|
1623
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
1624
|
+
};
|
|
1625
|
+
var planMarkCurrentSchema = {
|
|
1626
|
+
type: "object",
|
|
1627
|
+
properties: {
|
|
1628
|
+
planId: { type: "string" },
|
|
1629
|
+
versionId: {
|
|
1630
|
+
type: "string",
|
|
1631
|
+
description: "Existing version id to promote to current."
|
|
1632
|
+
},
|
|
1633
|
+
slug: { type: "string" }
|
|
1634
|
+
},
|
|
1635
|
+
required: ["planId", "versionId"],
|
|
1636
|
+
additionalProperties: false,
|
|
1637
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
1638
|
+
};
|
|
1639
|
+
var planAddLinkSchema = {
|
|
1640
|
+
type: "object",
|
|
1641
|
+
properties: {
|
|
1642
|
+
planId: { type: "string" },
|
|
1643
|
+
planVersionId: {
|
|
1644
|
+
type: "string",
|
|
1645
|
+
description: "Optional version id when the link applies to a specific snapshot."
|
|
1646
|
+
},
|
|
1647
|
+
targetType: planLinkTarget,
|
|
1648
|
+
targetId: {
|
|
1649
|
+
type: "string",
|
|
1650
|
+
description: "AgentOS-owned target id (goal/project/task/memory/session/plan). Required for workspace-owned link types."
|
|
1651
|
+
},
|
|
1652
|
+
targetUrl: {
|
|
1653
|
+
type: "string",
|
|
1654
|
+
description: "URL for remote refs (repo/branch/commit/pr/url/markdown). Either targetId or targetUrl is required."
|
|
1655
|
+
},
|
|
1656
|
+
label: { type: "string" },
|
|
1657
|
+
relation: {
|
|
1658
|
+
type: "string",
|
|
1659
|
+
description: "Optional free-form relation label (e.g. 'derived_from', 'supersedes')."
|
|
1660
|
+
},
|
|
1661
|
+
metadata: looseObject,
|
|
1662
|
+
slug: { type: "string" }
|
|
1663
|
+
},
|
|
1664
|
+
required: ["planId", "targetType"],
|
|
1665
|
+
additionalProperties: false,
|
|
1666
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
1667
|
+
};
|
|
1668
|
+
var planListLinksSchema = {
|
|
1669
|
+
type: "object",
|
|
1670
|
+
properties: {
|
|
1671
|
+
planId: { type: "string" },
|
|
1672
|
+
slug: { type: "string" }
|
|
1673
|
+
},
|
|
1674
|
+
required: ["planId"],
|
|
1675
|
+
additionalProperties: false,
|
|
1676
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
1677
|
+
};
|
|
1678
|
+
var planListVersionsSchema = {
|
|
1679
|
+
type: "object",
|
|
1680
|
+
properties: {
|
|
1681
|
+
planId: { type: "string" },
|
|
1682
|
+
slug: { type: "string" }
|
|
1683
|
+
},
|
|
1684
|
+
required: ["planId"],
|
|
1685
|
+
additionalProperties: false,
|
|
1686
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
1687
|
+
};
|
|
1688
|
+
|
|
1689
|
+
// src/tools/plans.ts
|
|
1690
|
+
function createPlanTools(config) {
|
|
1691
|
+
const mk = (name, description, parameters) => ({
|
|
1692
|
+
name,
|
|
1693
|
+
label: name,
|
|
1694
|
+
description,
|
|
1695
|
+
parameters,
|
|
1696
|
+
execute: (_toolCallId, params) => callAgentOsTool({
|
|
1697
|
+
serverName: config.agentOsServer,
|
|
1698
|
+
toolName: name,
|
|
1699
|
+
params,
|
|
1700
|
+
timeoutMs: config.timeoutMs,
|
|
1701
|
+
mcporterConfigPath: config.mcporterConfigPath,
|
|
1702
|
+
kynverApiUrl: config.kynverApiUrl,
|
|
1703
|
+
kynverApiKey: config.kynverApiKey,
|
|
1704
|
+
agentOsSlug: config.agentOsSlug,
|
|
1705
|
+
enableDirectHttp: config.enableDirectHttp
|
|
1706
|
+
})
|
|
1707
|
+
});
|
|
1708
|
+
return [
|
|
1709
|
+
mk(
|
|
1710
|
+
"agent_os_plan_create",
|
|
1711
|
+
"Create a first-class AgentOS plan with an initial version. Plans are versioned operational artifacts (separate from goals/projects/tasks) \u2014 the initial version body is required and becomes the plan's current version.",
|
|
1712
|
+
planCreateSchema
|
|
1713
|
+
),
|
|
1714
|
+
mk(
|
|
1715
|
+
"agent_os_plan_list",
|
|
1716
|
+
"List AgentOS plans, optionally filtered by status, projectId, goalId, or canonicalKey.",
|
|
1717
|
+
planListSchema
|
|
1718
|
+
),
|
|
1719
|
+
mk(
|
|
1720
|
+
"agent_os_plan_get",
|
|
1721
|
+
"Fetch one AgentOS plan with its full version history, current version pointer, and typed links.",
|
|
1722
|
+
planGetSchema
|
|
1723
|
+
),
|
|
1724
|
+
mk(
|
|
1725
|
+
"agent_os_plan_update",
|
|
1726
|
+
"Patch an AgentOS plan's metadata (title, summary, status, priority, owner, project/goal links, canonicalKey). The plan body itself is immutable \u2014 use agent_os_plan_add_version to record a new snapshot.",
|
|
1727
|
+
planUpdateSchema
|
|
1728
|
+
),
|
|
1729
|
+
mk(
|
|
1730
|
+
"agent_os_plan_add_version",
|
|
1731
|
+
"Append an immutable version snapshot to a plan. The new version's versionNumber is one greater than the latest, and (when markCurrent is true, the default) the plan's currentVersionId pointer advances atomically.",
|
|
1732
|
+
planAddVersionSchema
|
|
1733
|
+
),
|
|
1734
|
+
mk(
|
|
1735
|
+
"agent_os_plan_mark_current",
|
|
1736
|
+
"Promote an existing version of a plan to be the current version. The version must already belong to the plan.",
|
|
1737
|
+
planMarkCurrentSchema
|
|
1738
|
+
),
|
|
1739
|
+
mk(
|
|
1740
|
+
"agent_os_plan_add_link",
|
|
1741
|
+
"Add a typed link from a plan (and optionally a specific version) to a related goal, project, task, memory, session, repo, branch, commit, PR, URL, markdown file, or other plan. Workspace-owned targets are validated against the same AgentOS workspace server-side; remote refs (url/repo/branch/commit/pr/markdown) carry metadata only.",
|
|
1742
|
+
planAddLinkSchema
|
|
1743
|
+
),
|
|
1744
|
+
mk(
|
|
1745
|
+
"agent_os_plan_list_links",
|
|
1746
|
+
"List the typed links attached to a plan.",
|
|
1747
|
+
planListLinksSchema
|
|
1748
|
+
),
|
|
1749
|
+
mk(
|
|
1750
|
+
"agent_os_plan_list_versions",
|
|
1751
|
+
"List the version history of a plan in ascending order by versionNumber. agent_os_plan_get already returns versions; use this when you only need the version list.",
|
|
1752
|
+
planListVersionsSchema
|
|
1753
|
+
)
|
|
1208
1754
|
];
|
|
1209
1755
|
}
|
|
1210
1756
|
|
|
@@ -1785,7 +2331,8 @@ function createAllTools(config) {
|
|
|
1785
2331
|
...createMemoryTools(config),
|
|
1786
2332
|
...createSkillTools(config),
|
|
1787
2333
|
...createContactTools(config),
|
|
1788
|
-
...createTaskTools(config)
|
|
2334
|
+
...createTaskTools(config),
|
|
2335
|
+
...createPlanTools(config)
|
|
1789
2336
|
];
|
|
1790
2337
|
}
|
|
1791
2338
|
|