personal-bot 0.4.0 → 0.4.2
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/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +2 -2
- package/README.md +4 -1
- package/README.zh-CN.md +4 -1
- package/docs/README.md +2 -3
- package/docs/architecture/design.md +41 -2
- package/docs/architecture/extensibility.md +3 -3
- package/docs/architecture/model-context.md +10 -4
- package/docs/architecture/principles.md +2 -2
- package/docs/guides/cross-harness-workers.md +27 -2
- package/docs/guides/workspace-configuration.md +3 -1
- package/docs/hosts/claude-code.md +1 -1
- package/docs/hosts/codex-qoder.md +3 -1
- package/hooks/hooks.json +3 -0
- package/lib/antigravity-plugin/lib/extension/acp-worker.js +22 -6
- package/lib/antigravity-plugin/lib/extension/cli.js +169 -95
- package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.js +3 -1
- package/lib/antigravity-plugin/lib/extension/mcp.js +163 -119
- package/lib/antigravity-plugin/lib/integrations/agent-resources.d.ts +4 -2
- package/lib/antigravity-plugin/lib/integrations/agent-resources.js +23 -5
- package/lib/antigravity-plugin/lib/integrations/hosts/antigravity/adapter.js +0 -1
- package/lib/antigravity-plugin/lib/integrations/hosts/claude/adapter.js +1 -2
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/resources.d.ts +2 -1
- package/lib/antigravity-plugin/lib/integrations/hosts/dsh/resources.js +12 -13
- package/lib/antigravity-plugin/lib/integrations/hosts/prompt-hooks.js +4 -7
- package/lib/antigravity-plugin/lib/model/worker-template.d.ts +21 -0
- package/lib/antigravity-plugin/lib/model/worker-template.js +1 -0
- package/lib/antigravity-plugin/lib/services/history/summary-dimensions/monthly.js +1 -1
- package/lib/antigravity-plugin/lib/services/history/summary-dimensions/session.js +6 -3
- package/lib/antigravity-plugin/lib/services/history/summary-runner.js +3 -3
- package/lib/antigravity-plugin/lib/services/workspace/worker-templates.d.ts +17 -0
- package/lib/antigravity-plugin/lib/services/workspace/worker-templates.js +88 -0
- package/lib/antigravity-plugin/lib/storage/history-files.js +3 -2
- package/lib/antigravity-plugin/package.json +1 -1
- package/lib/antigravity-plugin/plugin.json +2 -2
- package/lib/antigravity-plugin/resources/agents/coordinator.md +2 -4
- package/lib/antigravity-plugin/resources/agents/general-purpose.md +2 -4
- package/lib/antigravity-plugin/resources/prompts/history-monthly-summary.md +6 -11
- package/lib/antigravity-plugin/resources/prompts/history-summary.md +6 -11
- package/lib/antigravity-plugin/resources/prompts/plugin-coordinator.md +1 -1
- package/lib/antigravity-plugin/resources/prompts/workspace.md +16 -23
- package/lib/antigravity-plugin/resources/skills/project-maintenance/SKILL.md +14 -21
- package/lib/antigravity-plugin/resources/skills/provider-connections/SKILL.md +23 -36
- package/lib/antigravity-plugin/resources/templates/workspace-agents.md +5 -13
- package/lib/antigravity-plugin/skills/pbot/SKILL.md +6 -23
- package/lib/antigravity-plugin/skills/project-maintenance/SKILL.md +14 -21
- package/lib/antigravity-plugin/skills/provider-connections/SKILL.md +23 -36
- package/lib/codex-marketplace/plugins/personal-bot/.codex-plugin/plugin.json +2 -2
- package/lib/codex-marketplace/plugins/personal-bot/.mcp.json +2 -2
- package/lib/codex-marketplace/plugins/personal-bot/hooks/hooks.json +3 -3
- package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/SKILL.md +11 -3
- package/lib/extension/acp-worker.js +22 -6
- package/lib/extension/cli.js +169 -95
- package/lib/extension/hosts/dsh/command.js +1 -1
- package/lib/extension/hosts/dsh/workspace.js +5 -2
- package/lib/extension/hosts/plugin-runtime.js +3 -1
- package/lib/extension/mcp/tool-contract.d.ts +3 -3
- package/lib/extension/mcp/tool-contract.js +63 -101
- package/lib/extension/mcp/workers.d.ts +1 -1
- package/lib/extension/mcp/workers.js +19 -13
- package/lib/extension/mcp.js +163 -119
- package/lib/integrations/agent-resources.d.ts +4 -2
- package/lib/integrations/agent-resources.js +23 -5
- package/lib/integrations/hosts/antigravity/adapter.js +0 -1
- package/lib/integrations/hosts/claude/adapter.js +1 -2
- package/lib/integrations/hosts/dsh/resources.d.ts +2 -1
- package/lib/integrations/hosts/dsh/resources.js +12 -13
- package/lib/integrations/hosts/prompt-hooks.js +4 -7
- package/lib/model/worker-template.d.ts +21 -0
- package/lib/model/worker-template.js +1 -0
- package/lib/qoder-plugin/.mcp.json +2 -2
- package/lib/qoder-plugin/.qoder-plugin/plugin.json +2 -2
- package/lib/qoder-plugin/hooks/hooks.json +3 -3
- package/lib/qoder-plugin/skills/pbot/SKILL.md +11 -3
- package/lib/services/agents/agent-service.js +2 -2
- package/lib/services/history/summary-dimensions/monthly.js +1 -1
- package/lib/services/history/summary-dimensions/session.js +6 -3
- package/lib/services/history/summary-runner.js +3 -3
- package/lib/services/workspace/worker-templates.d.ts +17 -0
- package/lib/services/workspace/worker-templates.js +88 -0
- package/lib/storage/history-files.js +3 -2
- package/lib/tools/history/contract.d.ts +1 -1
- package/lib/tools/history/contract.js +14 -16
- package/package.json +2 -2
- package/resources/agents/coordinator.md +2 -4
- package/resources/agents/general-purpose.md +2 -4
- package/resources/antigravity/skills/pbot/SKILL.md +6 -23
- package/resources/claude/skills/pbot/SKILL.md +6 -23
- package/resources/plugin/skills/pbot/SKILL.md +11 -3
- package/resources/prompts/history-coordinator.md +1 -1
- package/resources/prompts/history-monthly-summary.md +6 -11
- package/resources/prompts/history-summary.md +6 -11
- package/resources/prompts/plugin-coordinator.md +1 -1
- package/resources/prompts/workspace.md +16 -23
- package/resources/skills/project-maintenance/SKILL.md +14 -21
- package/resources/skills/provider-connections/SKILL.md +23 -36
- package/resources/templates/workspace-agents.md +5 -13
- package/src/extension/cli/commands/mcp.ts +1 -1
- package/src/extension/hosts/dsh/command.ts +1 -1
- package/src/extension/hosts/dsh/workspace.ts +5 -1
- package/src/extension/hosts/pi/command.ts +1 -1
- package/src/extension/hosts/pi/events.ts +3 -1
- package/src/extension/hosts/plugin-runtime.ts +3 -1
- package/src/extension/mcp/tool-contract.ts +63 -103
- package/src/extension/mcp/workers.ts +21 -14
- package/src/integrations/agent-resources.ts +27 -7
- package/src/integrations/hosts/antigravity/adapter.ts +0 -1
- package/src/integrations/hosts/claude/adapter.ts +1 -2
- package/src/integrations/hosts/dsh/resources.ts +14 -13
- package/src/integrations/hosts/prompt-hooks.ts +3 -6
- package/src/model/worker-template.ts +24 -0
- package/src/pbot.ts +2 -2
- package/src/services/agents/agent-service.ts +2 -2
- package/src/services/history/summary-dimensions/monthly.ts +1 -1
- package/src/services/history/summary-dimensions/session.ts +6 -3
- package/src/services/history/summary-runner.ts +3 -3
- package/src/services/workspace/worker-templates.ts +80 -0
- package/src/storage/history-files.ts +3 -2
- package/src/tools/history/contract.ts +14 -16
- package/docs/architecture/model-instruction-guidelines.md +0 -34
|
@@ -881,10 +881,10 @@ var require_truncate = __commonJS({
|
|
|
881
881
|
"node_modules/semver/functions/truncate.js"(exports, module) {
|
|
882
882
|
"use strict";
|
|
883
883
|
var parse = require_parse();
|
|
884
|
-
var
|
|
884
|
+
var constants5 = require_constants();
|
|
885
885
|
var SemVer = require_semver();
|
|
886
886
|
var truncate = (version, truncation, options) => {
|
|
887
|
-
if (!
|
|
887
|
+
if (!constants5.RELEASE_TYPES.includes(truncation)) {
|
|
888
888
|
return null;
|
|
889
889
|
}
|
|
890
890
|
const clonedVersion = cloneInputVersion(version, options);
|
|
@@ -1933,7 +1933,7 @@ var require_semver2 = __commonJS({
|
|
|
1933
1933
|
"node_modules/semver/index.js"(exports, module) {
|
|
1934
1934
|
"use strict";
|
|
1935
1935
|
var internalRe = require_re();
|
|
1936
|
-
var
|
|
1936
|
+
var constants5 = require_constants();
|
|
1937
1937
|
var SemVer = require_semver();
|
|
1938
1938
|
var identifiers = require_identifiers();
|
|
1939
1939
|
var parse = require_parse();
|
|
@@ -2017,8 +2017,8 @@ var require_semver2 = __commonJS({
|
|
|
2017
2017
|
re: internalRe.re,
|
|
2018
2018
|
src: internalRe.src,
|
|
2019
2019
|
tokens: internalRe.t,
|
|
2020
|
-
SEMVER_SPEC_VERSION:
|
|
2021
|
-
RELEASE_TYPES:
|
|
2020
|
+
SEMVER_SPEC_VERSION: constants5.SEMVER_SPEC_VERSION,
|
|
2021
|
+
RELEASE_TYPES: constants5.RELEASE_TYPES,
|
|
2022
2022
|
compareIdentifiers: identifiers.compareIdentifiers,
|
|
2023
2023
|
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
2024
2024
|
};
|
|
@@ -3310,7 +3310,7 @@ var init_history_files = __esm({
|
|
|
3310
3310
|
rawCount,
|
|
3311
3311
|
summaryCount,
|
|
3312
3312
|
total,
|
|
3313
|
-
message: `\
|
|
3313
|
+
message: `\u5F53\u524D\u6309\u5E74\u6708\u8BFB\u53D6\u5386\u53F2\uFF0C\u5E73\u94FA\u76EE\u5F55\u4E2D\u7684 ${rawCount} \u4EFD\u539F\u6587\u548C ${summaryCount} \u4EFD\u6458\u8981\u5C1A\u672A\u7EB3\u5165\u68C0\u7D22\u3002\u53EF\u5728\u5DE5\u4F5C\u533A\u6839\u76EE\u5F55\u7528 pbot history migrate --dry-run \u9884\u89C8\uFF0C\u7528 pbot history migrate \u6267\u884C\uFF08Pi\u3001dsh \u53EF\u7528 /pbot history migrate\uFF09\u3002\u8981\u7EE7\u7EED\u4F7F\u7528\u5E73\u94FA\u76EE\u5F55\uFF0C\u53EF\u5728 .pbot/config.json \u4E2D\u8BBE\u7F6E "history": { "layout": "flat" }\u3002`
|
|
3314
3314
|
};
|
|
3315
3315
|
}
|
|
3316
3316
|
listFlatRawFiles() {
|
|
@@ -3571,7 +3571,7 @@ var init_monthly = __esm({
|
|
|
3571
3571
|
monthlySummaryDimension = {
|
|
3572
3572
|
id: "monthly",
|
|
3573
3573
|
title: "\u6708\u5EA6\u5386\u53F2\u6C47\u603B",
|
|
3574
|
-
description: "\u6309\
|
|
3574
|
+
description: "\u6309\u4F1A\u8BDD\u5F00\u59CB\u7684 UTC \u6708\u4EFD\u6C47\u603B\u4F1A\u8BDD\u6458\u8981\uFF0C\u53EF\u4ECE\u6708\u5EA6\u7ED3\u679C\u67E5\u56DE\u5404\u4F1A\u8BDD\u3002",
|
|
3575
3575
|
requiresMonthlyLayout: true,
|
|
3576
3576
|
plan(_raws, existing, options = {}) {
|
|
3577
3577
|
const force = Boolean(options.force);
|
|
@@ -3780,7 +3780,7 @@ var init_session = __esm({
|
|
|
3780
3780
|
sessionSummaryDimension = {
|
|
3781
3781
|
id: "session",
|
|
3782
3782
|
title: "\u4F1A\u8BDD\u4EFB\u52A1\u6458\u8981",
|
|
3783
|
-
description: "\
|
|
3783
|
+
description: "\u6C47\u603B\u5355\u6B21\u4F1A\u8BDD\u7684\u76EE\u6807\u3001\u51B3\u5B9A\u3001\u7ED3\u679C\u548C\u672A\u51B3\u4E8B\u9879\u3002",
|
|
3784
3784
|
plan(raws, existing, options = {}) {
|
|
3785
3785
|
const force = Boolean(options.force);
|
|
3786
3786
|
const tasks = [];
|
|
@@ -3841,10 +3841,13 @@ var init_session = __esm({
|
|
|
3841
3841
|
`\u3010\u5DF2\u6709\u6458\u8981\uFF08${task.existing.from} \u2014 ${task.existing.to}\uFF09\u3011
|
|
3842
3842
|
${task.existing.text}`,
|
|
3843
3843
|
`\u3010\u65B0\u589E\u5BF9\u8BDD\u3011
|
|
3844
|
-
${formatExchanges(task.addedExchanges)}
|
|
3845
|
-
"\u5728\u5DF2\u6709\u6458\u8981\u57FA\u7840\u4E0A\u5408\u5E76\u65B0\u589E\u5BF9\u8BDD\uFF0C\u8F93\u51FA\u66F4\u65B0\u540E\u7684\u5B8C\u6574\u6458\u8981\uFF1A\u4FDD\u7559\u4ECD\u6709\u6548\u7684\u4E8B\u5B9E\uFF0C\u7528\u65B0\u51B3\u5B9A\u8986\u76D6\u65E7\u51B3\u5B9A\uFF0C\u53BB\u91CD\u5E76\u4FDD\u6301\u7B80\u6D01\u3002"
|
|
3844
|
+
${formatExchanges(task.addedExchanges)}`
|
|
3846
3845
|
].join("\n\n");
|
|
3847
|
-
return {
|
|
3846
|
+
return {
|
|
3847
|
+
system: system + "\n\u5408\u5E76\u5DF2\u6709\u6458\u8981\u4E0E\u65B0\u589E\u5BF9\u8BDD\uFF0C\u8F93\u51FA\u5B8C\u6574\u6458\u8981\u3002\u4FDD\u7559\u4ECD\u6709\u6548\u7684\u4E8B\u5B9E\uFF0C\u7528\u540E\u7EED\u660E\u786E\u7684\u51B3\u5B9A\u66F4\u65B0\u76F8\u5E94\u7ED3\u8BBA\u3002",
|
|
3848
|
+
prompt: prompt2,
|
|
3849
|
+
maxTokens: 2048
|
|
3850
|
+
};
|
|
3848
3851
|
}
|
|
3849
3852
|
const prompt = [
|
|
3850
3853
|
...heading,
|
|
@@ -3956,7 +3959,8 @@ function evaluateSummaryReminder(raws, allSummaries, pendingCount, options = {})
|
|
|
3956
3959
|
if (latestSummaryMs !== void 0 && nowMs - latestSummaryMs < thresholdMs) return void 0;
|
|
3957
3960
|
const rawAgeDays = Math.floor((nowMs - oldestRawMs) / dayMs);
|
|
3958
3961
|
const daysSinceLastSummary = latestSummaryMs === void 0 ? void 0 : Math.floor((nowMs - latestSummaryMs) / dayMs);
|
|
3959
|
-
const
|
|
3962
|
+
const lastUpdate = daysSinceLastSummary === void 0 ? "\u5C1A\u65E0\u6458\u8981" : `\u4E0A\u6B21\u66F4\u65B0\u6458\u8981\u5728 ${daysSinceLastSummary} \u5929\u524D`;
|
|
3963
|
+
const message = `\u5DE5\u4F5C\u533A\u5DF2\u79EF\u7D2F ${rawAgeDays} \u5929\u7684\u5386\u53F2\uFF0C${lastUpdate}\uFF0C${pendingCount} \u9879\u5F85\u6458\u8981\u3002\u53EF\u5728\u5DE5\u4F5C\u533A\u6839\u76EE\u5F55\u8FD0\u884C pbot history summary\uFF0C\u6216\u5728 Pi\u3001dsh \u4F1A\u8BDD\u4E2D\u8F93\u5165 /pbot history summary\u3002`;
|
|
3960
3964
|
return {
|
|
3961
3965
|
rawCount: raws.length,
|
|
3962
3966
|
pendingCount,
|
|
@@ -12452,11 +12456,11 @@ var require_codegen = __commonJS({
|
|
|
12452
12456
|
const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
12453
12457
|
return `${varKind} ${this.name}${rhs};` + _n;
|
|
12454
12458
|
}
|
|
12455
|
-
optimizeNames(names,
|
|
12459
|
+
optimizeNames(names, constants5) {
|
|
12456
12460
|
if (!names[this.name.str])
|
|
12457
12461
|
return;
|
|
12458
12462
|
if (this.rhs)
|
|
12459
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
12463
|
+
this.rhs = optimizeExpr(this.rhs, names, constants5);
|
|
12460
12464
|
return this;
|
|
12461
12465
|
}
|
|
12462
12466
|
get names() {
|
|
@@ -12473,10 +12477,10 @@ var require_codegen = __commonJS({
|
|
|
12473
12477
|
render({ _n }) {
|
|
12474
12478
|
return `${this.lhs} = ${this.rhs};` + _n;
|
|
12475
12479
|
}
|
|
12476
|
-
optimizeNames(names,
|
|
12480
|
+
optimizeNames(names, constants5) {
|
|
12477
12481
|
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
|
12478
12482
|
return;
|
|
12479
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
12483
|
+
this.rhs = optimizeExpr(this.rhs, names, constants5);
|
|
12480
12484
|
return this;
|
|
12481
12485
|
}
|
|
12482
12486
|
get names() {
|
|
@@ -12537,8 +12541,8 @@ var require_codegen = __commonJS({
|
|
|
12537
12541
|
optimizeNodes() {
|
|
12538
12542
|
return `${this.code}` ? this : void 0;
|
|
12539
12543
|
}
|
|
12540
|
-
optimizeNames(names,
|
|
12541
|
-
this.code = optimizeExpr(this.code, names,
|
|
12544
|
+
optimizeNames(names, constants5) {
|
|
12545
|
+
this.code = optimizeExpr(this.code, names, constants5);
|
|
12542
12546
|
return this;
|
|
12543
12547
|
}
|
|
12544
12548
|
get names() {
|
|
@@ -12567,12 +12571,12 @@ var require_codegen = __commonJS({
|
|
|
12567
12571
|
}
|
|
12568
12572
|
return nodes.length > 0 ? this : void 0;
|
|
12569
12573
|
}
|
|
12570
|
-
optimizeNames(names,
|
|
12574
|
+
optimizeNames(names, constants5) {
|
|
12571
12575
|
const { nodes } = this;
|
|
12572
12576
|
let i = nodes.length;
|
|
12573
12577
|
while (i--) {
|
|
12574
12578
|
const n = nodes[i];
|
|
12575
|
-
if (n.optimizeNames(names,
|
|
12579
|
+
if (n.optimizeNames(names, constants5))
|
|
12576
12580
|
continue;
|
|
12577
12581
|
subtractNames(names, n.names);
|
|
12578
12582
|
nodes.splice(i, 1);
|
|
@@ -12625,12 +12629,12 @@ var require_codegen = __commonJS({
|
|
|
12625
12629
|
return void 0;
|
|
12626
12630
|
return this;
|
|
12627
12631
|
}
|
|
12628
|
-
optimizeNames(names,
|
|
12632
|
+
optimizeNames(names, constants5) {
|
|
12629
12633
|
var _a;
|
|
12630
|
-
this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names,
|
|
12631
|
-
if (!(super.optimizeNames(names,
|
|
12634
|
+
this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants5);
|
|
12635
|
+
if (!(super.optimizeNames(names, constants5) || this.else))
|
|
12632
12636
|
return;
|
|
12633
|
-
this.condition = optimizeExpr(this.condition, names,
|
|
12637
|
+
this.condition = optimizeExpr(this.condition, names, constants5);
|
|
12634
12638
|
return this;
|
|
12635
12639
|
}
|
|
12636
12640
|
get names() {
|
|
@@ -12653,10 +12657,10 @@ var require_codegen = __commonJS({
|
|
|
12653
12657
|
render(opts) {
|
|
12654
12658
|
return `for(${this.iteration})` + super.render(opts);
|
|
12655
12659
|
}
|
|
12656
|
-
optimizeNames(names,
|
|
12657
|
-
if (!super.optimizeNames(names,
|
|
12660
|
+
optimizeNames(names, constants5) {
|
|
12661
|
+
if (!super.optimizeNames(names, constants5))
|
|
12658
12662
|
return;
|
|
12659
|
-
this.iteration = optimizeExpr(this.iteration, names,
|
|
12663
|
+
this.iteration = optimizeExpr(this.iteration, names, constants5);
|
|
12660
12664
|
return this;
|
|
12661
12665
|
}
|
|
12662
12666
|
get names() {
|
|
@@ -12692,10 +12696,10 @@ var require_codegen = __commonJS({
|
|
|
12692
12696
|
render(opts) {
|
|
12693
12697
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
12694
12698
|
}
|
|
12695
|
-
optimizeNames(names,
|
|
12696
|
-
if (!super.optimizeNames(names,
|
|
12699
|
+
optimizeNames(names, constants5) {
|
|
12700
|
+
if (!super.optimizeNames(names, constants5))
|
|
12697
12701
|
return;
|
|
12698
|
-
this.iterable = optimizeExpr(this.iterable, names,
|
|
12702
|
+
this.iterable = optimizeExpr(this.iterable, names, constants5);
|
|
12699
12703
|
return this;
|
|
12700
12704
|
}
|
|
12701
12705
|
get names() {
|
|
@@ -12737,11 +12741,11 @@ var require_codegen = __commonJS({
|
|
|
12737
12741
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
12738
12742
|
return this;
|
|
12739
12743
|
}
|
|
12740
|
-
optimizeNames(names,
|
|
12744
|
+
optimizeNames(names, constants5) {
|
|
12741
12745
|
var _a, _b;
|
|
12742
|
-
super.optimizeNames(names,
|
|
12743
|
-
(_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names,
|
|
12744
|
-
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names,
|
|
12746
|
+
super.optimizeNames(names, constants5);
|
|
12747
|
+
(_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants5);
|
|
12748
|
+
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants5);
|
|
12745
12749
|
return this;
|
|
12746
12750
|
}
|
|
12747
12751
|
get names() {
|
|
@@ -13042,7 +13046,7 @@ var require_codegen = __commonJS({
|
|
|
13042
13046
|
function addExprNames(names, from) {
|
|
13043
13047
|
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
|
13044
13048
|
}
|
|
13045
|
-
function optimizeExpr(expr, names,
|
|
13049
|
+
function optimizeExpr(expr, names, constants5) {
|
|
13046
13050
|
if (expr instanceof code_1.Name)
|
|
13047
13051
|
return replaceName(expr);
|
|
13048
13052
|
if (!canOptimize(expr))
|
|
@@ -13057,14 +13061,14 @@ var require_codegen = __commonJS({
|
|
|
13057
13061
|
return items;
|
|
13058
13062
|
}, []));
|
|
13059
13063
|
function replaceName(n) {
|
|
13060
|
-
const c =
|
|
13064
|
+
const c = constants5[n.str];
|
|
13061
13065
|
if (c === void 0 || names[n.str] !== 1)
|
|
13062
13066
|
return n;
|
|
13063
13067
|
delete names[n.str];
|
|
13064
13068
|
return c;
|
|
13065
13069
|
}
|
|
13066
13070
|
function canOptimize(e) {
|
|
13067
|
-
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 &&
|
|
13071
|
+
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants5[c.str] !== void 0);
|
|
13068
13072
|
}
|
|
13069
13073
|
}
|
|
13070
13074
|
function subtractNames(names, from) {
|
|
@@ -15026,7 +15030,7 @@ var require_compile = __commonJS({
|
|
|
15026
15030
|
const schOrFunc = root.refs[ref];
|
|
15027
15031
|
if (schOrFunc)
|
|
15028
15032
|
return schOrFunc;
|
|
15029
|
-
let _sch =
|
|
15033
|
+
let _sch = resolve11.call(this, root, ref);
|
|
15030
15034
|
if (_sch === void 0) {
|
|
15031
15035
|
const schema2 = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
15032
15036
|
const { schemaId } = this.opts;
|
|
@@ -15053,7 +15057,7 @@ var require_compile = __commonJS({
|
|
|
15053
15057
|
function sameSchemaEnv(s1, s2) {
|
|
15054
15058
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
15055
15059
|
}
|
|
15056
|
-
function
|
|
15060
|
+
function resolve11(root, ref) {
|
|
15057
15061
|
let sch;
|
|
15058
15062
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
15059
15063
|
ref = sch;
|
|
@@ -15917,7 +15921,7 @@ var require_fast_uri = __commonJS({
|
|
|
15917
15921
|
}
|
|
15918
15922
|
return uri;
|
|
15919
15923
|
}
|
|
15920
|
-
function
|
|
15924
|
+
function resolve11(baseURI, relativeURI, options) {
|
|
15921
15925
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
15922
15926
|
const {
|
|
15923
15927
|
parsed: baseParsed,
|
|
@@ -16308,7 +16312,7 @@ var require_fast_uri = __commonJS({
|
|
|
16308
16312
|
var fastUri = {
|
|
16309
16313
|
SCHEMES,
|
|
16310
16314
|
normalize,
|
|
16311
|
-
resolve:
|
|
16315
|
+
resolve: resolve11,
|
|
16312
16316
|
resolveComponent,
|
|
16313
16317
|
equal,
|
|
16314
16318
|
serialize,
|
|
@@ -19382,7 +19386,7 @@ var init_contract = __esm({
|
|
|
19382
19386
|
host: identifier,
|
|
19383
19387
|
id: typebox_exports.String(),
|
|
19384
19388
|
kind: typebox_exports.Union([typebox_exports.Literal("session"), typebox_exports.Literal("exchange"), typebox_exports.Literal("summary")], {
|
|
19385
|
-
description: "session
|
|
19389
|
+
description: "session \u4E3A\u4F1A\u8BDD\uFF0Csummary \u4E3A\u6458\u8981\uFF0Cexchange \u4E3A\u5355\u8F6E\u95EE\u7B54\u539F\u6587\u3002"
|
|
19386
19390
|
}),
|
|
19387
19391
|
dimension: typebox_exports.Optional(identifier),
|
|
19388
19392
|
sessionId: typebox_exports.String(),
|
|
@@ -19391,7 +19395,7 @@ var init_contract = __esm({
|
|
|
19391
19395
|
from: typebox_exports.String(),
|
|
19392
19396
|
to: typebox_exports.String(),
|
|
19393
19397
|
ready: typebox_exports.Boolean({ description: "\u6B63\u6587\u6216\u6458\u8981\u662F\u5426\u5DF2\u751F\u6210\u3002" }),
|
|
19394
|
-
completed: typebox_exports.Boolean({ description: "\
|
|
19398
|
+
completed: typebox_exports.Boolean({ description: "false \u8868\u793A\u4F1A\u8BDD\u6216\u95EE\u7B54\u4E2D\u65AD\u6216\u672A\u5B8C\u6210\u3002" })
|
|
19395
19399
|
});
|
|
19396
19400
|
historyResultSchema = typebox_exports.Object({
|
|
19397
19401
|
matches: typebox_exports.Optional(typebox_exports.Array(typebox_exports.Object({
|
|
@@ -19421,18 +19425,18 @@ var init_contract = __esm({
|
|
|
19421
19425
|
});
|
|
19422
19426
|
historyParameters = typebox_exports.Object({
|
|
19423
19427
|
action: typebox_exports.Union([typebox_exports.Literal("search"), typebox_exports.Literal("read")], {
|
|
19424
|
-
description: "search \u641C\u7D22\u6216\u5217\
|
|
19428
|
+
description: "search \u641C\u7D22\u6216\u5217\u51FA\u8BB0\u5F55\uFF0Cread \u6309 id \u8BFB\u53D6\u6B63\u6587\u548C\u4E0A\u4E0B\u7EA7\u3002"
|
|
19425
19429
|
}),
|
|
19426
|
-
host: nullable(typebox_exports.String({ pattern: historyIdentifierPattern.source, description: "\u6765\u6E90\u5BBF\u4E3B\
|
|
19427
|
-
dimension: nullable(typebox_exports.String({ pattern: historyIdentifierPattern.source, description: "
|
|
19428
|
-
query: nullable(typebox_exports.String({ description: "
|
|
19429
|
-
sessionId: nullable(typebox_exports.String({ description: "
|
|
19430
|
-
from: nullable(typebox_exports.String({ description: "
|
|
19431
|
-
to: nullable(typebox_exports.String({ description: "\u4EC5
|
|
19432
|
-
id: nullable(typebox_exports.String({ description: "
|
|
19433
|
-
offset: nullable(typebox_exports.Integer({ minimum: 0, description: "
|
|
19434
|
-
limit: nullable(typebox_exports.Integer({ minimum: 1, maximum: historyPageLimits.read.max, description: `search\
|
|
19435
|
-
childrenOffset: nullable(typebox_exports.Integer({ minimum: 0, description: "
|
|
19430
|
+
host: nullable(typebox_exports.String({ pattern: historyIdentifierPattern.source, description: "\u6765\u6E90\u5BBF\u4E3B\uFF0C\u5982 pi \u6216 claude\u3002\u53EF\u7B5B\u9009\u641C\u7D22\u7ED3\u679C\u6216\u533A\u5206\u91CD\u540D\u8282\u70B9\u3002" })),
|
|
19431
|
+
dimension: nullable(typebox_exports.String({ pattern: historyIdentifierPattern.source, description: "search \u7684\u8303\u56F4\u3002raw \u4E3A\u539F\u59CB\u95EE\u7B54\uFF0Csession\u3001monthly \u7B49\u4E3A\u6458\u8981\u7EF4\u5EA6\u3002\u5173\u952E\u8BCD\u641C\u7D22\u9ED8\u8BA4\u67E5\u5168\u90E8\u3002" })),
|
|
19432
|
+
query: nullable(typebox_exports.String({ description: "search \u5339\u914D\u8FDE\u7EED\u6587\u672C\uFF0C\u5FFD\u7565\u5927\u5C0F\u5199\u3002\u7701\u7565\u65F6\u5217\u4F1A\u8BDD\uFF0C\u6307\u5B9A\u6458\u8981\u7EF4\u5EA6\u5219\u5217\u8BE5\u7EF4\u5EA6\u7684\u6458\u8981\u3002" })),
|
|
19433
|
+
sessionId: nullable(typebox_exports.String({ description: "search \u6309\u539F\u59CB\u4F1A\u8BDD ID \u7B5B\u9009\u3002" })),
|
|
19434
|
+
from: nullable(typebox_exports.String({ description: "search \u65F6\u95F4\u533A\u95F4\u8D77\u70B9\uFF08\u542B\uFF09\uFF0C\u7528 ISO \u65E5\u671F\u6216\u65F6\u95F4\u3002" })),
|
|
19435
|
+
to: nullable(typebox_exports.String({ description: "search \u65F6\u95F4\u533A\u95F4\u7EC8\u70B9\uFF08\u542B\uFF09\uFF0C\u4EC5\u586B\u65E5\u671F\u8868\u793A\u8BE5\u65E5 UTC \u96F6\u70B9\u3002" })),
|
|
19436
|
+
id: nullable(typebox_exports.String({ description: "read \u5FC5\u586B\u3002\u4F7F\u7528\u641C\u7D22\u7ED3\u679C\u3001\u7236\u8282\u70B9\u6216\u5B50\u8282\u70B9\u7684 id\u3002" })),
|
|
19437
|
+
offset: nullable(typebox_exports.Integer({ minimum: 0, description: "\u7FFB\u9875\u4F20\u4E0A\u9875\u7684 nextOffset\u3002search \u6309\u6761\u76EE\uFF0Cread \u6309\u6B63\u6587\u5B57\u7B26\uFF0C\u9ED8\u8BA4\u4ECE 0 \u5F00\u59CB\u3002" })),
|
|
19438
|
+
limit: nullable(typebox_exports.Integer({ minimum: 1, maximum: historyPageLimits.read.max, description: `search \u6BCF\u9875\u9ED8\u8BA4 ${historyPageLimits.search.default} \u6761\uFF0C\u6700\u591A ${historyPageLimits.search.max} \u6761\u3002read \u6BCF\u9875\u9ED8\u8BA4 ${historyPageLimits.read.default} \u4E2A\u5B57\u7B26\u3002` })),
|
|
19439
|
+
childrenOffset: nullable(typebox_exports.Integer({ minimum: 0, description: "read \u7684\u5B50\u8282\u70B9\u8D77\u70B9\uFF0C\u9ED8\u8BA4 0\u3002\u7FFB\u9875\u4F20\u4E0A\u9875\u7684 nextChildrenOffset\u3002" }))
|
|
19436
19440
|
}, { additionalProperties: false });
|
|
19437
19441
|
valid2 = schema(historyParameters);
|
|
19438
19442
|
}
|
|
@@ -20478,7 +20482,6 @@ var antigravityAdapter = {
|
|
|
20478
20482
|
host: "antigravity",
|
|
20479
20483
|
nativeRootAgents: true,
|
|
20480
20484
|
nativeWorkspaceSkills: true,
|
|
20481
|
-
coordinatorPrompt: "plugin-coordinator.md",
|
|
20482
20485
|
initCommandHint: "/pbot init",
|
|
20483
20486
|
usage: "\u7528\u6CD5\uFF1Anode <\u63D2\u4EF6\u76EE\u5F55>/lib/plugin.js antigravity init|status",
|
|
20484
20487
|
resolveRoot(cwd, rawPayload) {
|
|
@@ -20559,12 +20562,9 @@ function parsePromptEvent(value) {
|
|
|
20559
20562
|
if (name !== "Stop" && name !== "UserPromptSubmit" && name !== "SessionStart") return { kind: "ignore" };
|
|
20560
20563
|
if (typeof value.agent_id === "string") return { kind: "ignore" };
|
|
20561
20564
|
requireThat(typeof value.cwd === "string", "\u63D2\u4EF6 hook \u7F3A\u5C11\u5DE5\u4F5C\u76EE\u5F55\u3002");
|
|
20562
|
-
if (name
|
|
20563
|
-
if (
|
|
20564
|
-
|
|
20565
|
-
return { kind: "inject-context", role: "coordinator", isSessionStart: true, noticesOnly: true, cwd: value.cwd, raw: value };
|
|
20566
|
-
}
|
|
20567
|
-
return { kind: "inject-context", role: "coordinator", cwd: value.cwd, raw: value };
|
|
20565
|
+
if (name !== "SessionStart") return { kind: "record-history", cwd: value.cwd, raw: value };
|
|
20566
|
+
if (value.source === "resume" || value.source === "compact") return { kind: "ignore" };
|
|
20567
|
+
return { kind: "inject-context", role: "coordinator", isSessionStart: true, cwd: value.cwd, raw: value };
|
|
20568
20568
|
}
|
|
20569
20569
|
var promptHooks = {
|
|
20570
20570
|
async extractHistory(event) {
|
|
@@ -20610,7 +20610,7 @@ var promptHooks = {
|
|
|
20610
20610
|
};
|
|
20611
20611
|
|
|
20612
20612
|
// src/integrations/hosts/claude/adapter.ts
|
|
20613
|
-
var supportedEvents2 = ["UserPromptSubmit", "PreToolUse", "UserPromptExpansion", "Stop"];
|
|
20613
|
+
var supportedEvents2 = ["SessionStart", "UserPromptSubmit", "PreToolUse", "UserPromptExpansion", "Stop"];
|
|
20614
20614
|
var boundWorkspaceRoot = () => process.env.CLAUDE_PROJECT_DIR;
|
|
20615
20615
|
async function claudeWorkspaceRoot(cwd, projectDirectory = boundWorkspaceRoot()) {
|
|
20616
20616
|
return pluginWorkspaceRoot(projectDirectory || cwd);
|
|
@@ -20619,7 +20619,6 @@ var claudeAdapter = {
|
|
|
20619
20619
|
host: "claude",
|
|
20620
20620
|
nativeRootAgents: false,
|
|
20621
20621
|
nativeWorkspaceSkills: false,
|
|
20622
|
-
coordinatorPrompt: "plugin-coordinator.md",
|
|
20623
20622
|
initCommandHint: "/personal-bot:pbot init",
|
|
20624
20623
|
usage: "\u7528\u6CD5\uFF1Anode <\u63D2\u4EF6\u76EE\u5F55>/lib/claude.js init|status",
|
|
20625
20624
|
boundWorkspaceRoot,
|
|
@@ -20865,7 +20864,7 @@ async function removeWorkspaceMcpServer(root, name) {
|
|
|
20865
20864
|
}
|
|
20866
20865
|
|
|
20867
20866
|
// src/extension/cli/commands/mcp.ts
|
|
20868
|
-
var mcpUsage = "\u7528\u6CD5\uFF1A\n pbot mcp\n pbot mcp list [--workspace <\u76EE\u5F55>] [--json]\n pbot mcp add <name> --url <url> [--header K=V]... [--description <\u8BF4\u660E>] [--timeout <\u79D2>] [--disabled] [--workspace <\u76EE\u5F55>]\n pbot mcp add <name> [--env K=V]... [--cwd <\u76EE\u5F55>] [--description <\u8BF4\u660E>] [--timeout <\u79D2>] [--disabled] [--workspace <\u76EE\u5F55>] -- <command> [args...]\n pbot mcp remove <name> [--workspace <\u76EE\u5F55>]\n\n\
|
|
20867
|
+
var mcpUsage = "\u7528\u6CD5\uFF1A\n pbot mcp\n pbot mcp list [--workspace <\u76EE\u5F55>] [--json]\n pbot mcp add <name> --url <url> [--header K=V]... [--description <\u8BF4\u660E>] [--timeout <\u79D2>] [--disabled] [--workspace <\u76EE\u5F55>]\n pbot mcp add <name> [--env K=V]... [--cwd <\u76EE\u5F55>] [--description <\u8BF4\u660E>] [--timeout <\u79D2>] [--disabled] [--workspace <\u76EE\u5F55>] -- <command> [args...]\n pbot mcp remove <name> [--workspace <\u76EE\u5F55>]\n\n\u4E0D\u5E26\u5B50\u547D\u4EE4\u65F6\u542F\u52A8 stdio MCP \u670D\u52A1\u3002\u7528 list\u3001add\u3001remove \u7BA1\u7406\u5DE5\u4F5C\u533A\u7684 .pbot/mcp.json\u3002";
|
|
20869
20868
|
async function runMcpServer() {
|
|
20870
20869
|
const entry = join19(packageRoot, "lib/extension/mcp.js");
|
|
20871
20870
|
if (!existsSync2(entry)) {
|
|
@@ -21021,7 +21020,7 @@ init_validation();
|
|
|
21021
21020
|
|
|
21022
21021
|
// src/extension/hosts/plugin-runtime.ts
|
|
21023
21022
|
init_paths();
|
|
21024
|
-
import { join as
|
|
21023
|
+
import { join as join24 } from "node:path";
|
|
21025
21024
|
init_validation();
|
|
21026
21025
|
|
|
21027
21026
|
// src/integrations/agent-resources.ts
|
|
@@ -21044,7 +21043,7 @@ async function readLocalRole(agent, root) {
|
|
|
21044
21043
|
async function agentText(agent, root, coordinatorPrompt = "plugin-coordinator.md") {
|
|
21045
21044
|
requireThat(agent === "coordinator" || agent === "general-purpose", "\u672A\u77E5\u804C\u8D23\u3002");
|
|
21046
21045
|
let text = await readFile8(join20(resourceRoot, "agents", agent + ".md"), "utf8");
|
|
21047
|
-
if (agent === "coordinator") {
|
|
21046
|
+
if (agent === "coordinator" && coordinatorPrompt) {
|
|
21048
21047
|
text += "\n\n" + await readFile8(join20(resourceRoot, "prompts", coordinatorPrompt), "utf8");
|
|
21049
21048
|
}
|
|
21050
21049
|
const local = await readLocalRole(agent, root);
|
|
@@ -21055,7 +21054,21 @@ async function agentText(agent, root, coordinatorPrompt = "plugin-coordinator.md
|
|
|
21055
21054
|
function formatWorkspaceSkills(skills) {
|
|
21056
21055
|
if (!skills.length) return "";
|
|
21057
21056
|
const lines = skills.map((skill) => `- **${skill.name}**\uFF08\`${skill.path}\`\uFF09\uFF1A${skill.description}`);
|
|
21058
|
-
return "## \
|
|
21057
|
+
return "## \u6309\u9700\u8BFB\u53D6\u7684\u6280\u80FD\n\n" + lines.join("\n");
|
|
21058
|
+
}
|
|
21059
|
+
function formatWorkerTemplates(templates) {
|
|
21060
|
+
if (!templates.length) return "";
|
|
21061
|
+
const lines = templates.map(({ id, name, description, create }) => {
|
|
21062
|
+
const label = name === id ? id : `${name}\uFF08${id}\uFF09`;
|
|
21063
|
+
const settings2 = [
|
|
21064
|
+
["\u52A9\u624B", create.backend],
|
|
21065
|
+
["\u6267\u884C\u5DE5\u4F5C\u533A", create.workspace],
|
|
21066
|
+
["\u6A21\u578B", create.model],
|
|
21067
|
+
["\u601D\u8003\u6DF1\u5EA6", create.thinking]
|
|
21068
|
+
].filter(([, value]) => value !== void 0).map(([field, value]) => `${field} ${JSON.stringify(value)}`).join("\uFF0C");
|
|
21069
|
+
return `- ${label}\u3000${description}\uFF08${settings2}\uFF09`;
|
|
21070
|
+
});
|
|
21071
|
+
return "## \u5DE5\u4F5C\u533A\u52A9\u624B\u6A21\u677F\n\n\u9009\u7528\u6A21\u677F\u65F6\uFF0C\u7528 worker_discover \u67E5\u8BE2\u6700\u65B0\u8BBE\u7F6E\uFF08target=templates\uFF09\u3002\n\n" + lines.join("\n");
|
|
21059
21072
|
}
|
|
21060
21073
|
async function loadWorkspaceContext(options) {
|
|
21061
21074
|
const {
|
|
@@ -21069,13 +21082,15 @@ async function loadWorkspaceContext(options) {
|
|
|
21069
21082
|
workspaceSkills = [],
|
|
21070
21083
|
notices = []
|
|
21071
21084
|
} = options;
|
|
21072
|
-
const [workspace,
|
|
21085
|
+
const [workspace, baseRole, rootAgents, catalog] = includePrompts ? await Promise.all([
|
|
21073
21086
|
readFile8(join20(resourceRoot, "prompts/workspace.md"), "utf8"),
|
|
21074
21087
|
localRoleOnly ? readLocalRole(role, root) : agentText(role, root, coordinatorPrompt),
|
|
21075
|
-
includeRootAgents ? readOptionalFile(join20(root, "AGENTS.md")) : Promise.resolve("")
|
|
21076
|
-
|
|
21088
|
+
includeRootAgents ? readOptionalFile(join20(root, "AGENTS.md")) : Promise.resolve(""),
|
|
21089
|
+
role === "coordinator" ? options.readWorkerTemplates?.(root) : void 0
|
|
21090
|
+
]) : ["", "", "", void 0];
|
|
21091
|
+
const roleText = [baseRole, formatWorkerTemplates(catalog?.templates ?? [])].filter(Boolean).join("\n\n");
|
|
21077
21092
|
const skillsSection = formatWorkspaceSkills(workspaceSkills);
|
|
21078
|
-
const noticesSection = notices.length ? "## \
|
|
21093
|
+
const noticesSection = notices.length ? "## \u7EF4\u62A4\u63D0\u9192\n\n\u544A\u77E5\u7528\u6237\uFF0C\u6309\u7528\u6237\u8981\u6C42\u6267\u884C\u3002\n\n" + notices.map((item) => `- ${item}`).join("\n") : "";
|
|
21079
21094
|
const environment = { host, workspaceRoot: root, resourceRoot };
|
|
21080
21095
|
const text = [
|
|
21081
21096
|
workspace,
|
|
@@ -21180,12 +21195,70 @@ function recordHistoryCapture(root, host, capture) {
|
|
|
21180
21195
|
init_summary_runner();
|
|
21181
21196
|
init_workspace_config2();
|
|
21182
21197
|
|
|
21198
|
+
// src/services/workspace/worker-templates.ts
|
|
21199
|
+
import { constants as constants4 } from "node:fs";
|
|
21200
|
+
import { open } from "node:fs/promises";
|
|
21201
|
+
init_json();
|
|
21202
|
+
import { join as join21, resolve as resolve10 } from "node:path";
|
|
21203
|
+
var templateIdPattern = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
21204
|
+
var templateFields = ["name", "description", "create"];
|
|
21205
|
+
var createFields = ["backend", "workspace", "model", "thinking"];
|
|
21206
|
+
function validString(value) {
|
|
21207
|
+
return typeof value === "string" && value.trim().length > 0 && !value.includes("\0");
|
|
21208
|
+
}
|
|
21209
|
+
function parseTemplate(id, entry) {
|
|
21210
|
+
if (!templateIdPattern.test(id)) return { id, message: "\u6A21\u677F\u6807\u8BC6\u65E0\u6548\u3002" };
|
|
21211
|
+
if (!object(entry) || Object.keys(entry).some((key) => !templateFields.includes(key))) {
|
|
21212
|
+
return { id, message: "\u6A21\u677F\u8BBE\u7F6E\u65E0\u6548\u3002" };
|
|
21213
|
+
}
|
|
21214
|
+
const { name = id, description, create } = entry;
|
|
21215
|
+
if (!validString(name)) return { id, message: "\u6A21\u677F\u540D\u79F0\u65E0\u6548\u3002" };
|
|
21216
|
+
if (!validString(description)) return { id, message: "\u6A21\u677F\u7F3A\u5C11\u6709\u6548\u7684\u804C\u8D23\u8BF4\u660E\u3002" };
|
|
21217
|
+
if (!object(create) || Object.keys(create).some((key) => !createFields.includes(key))) {
|
|
21218
|
+
return { id, message: "\u52A9\u624B\u7684\u542F\u52A8\u8BBE\u7F6E\u65E0\u6548\u3002" };
|
|
21219
|
+
}
|
|
21220
|
+
if (!validString(create.backend)) return { id, message: "\u6A21\u677F\u7F3A\u5C11\u6709\u6548\u7684\u52A9\u624B\u6807\u8BC6\u3002" };
|
|
21221
|
+
const options = { backend: create.backend, workspace: "." };
|
|
21222
|
+
for (const key of ["workspace", "model", "thinking"]) {
|
|
21223
|
+
const value = create[key];
|
|
21224
|
+
if (value === void 0) continue;
|
|
21225
|
+
if (!validString(value)) return { id, message: "\u52A9\u624B\u7684\u542F\u52A8\u8BBE\u7F6E\u65E0\u6548\u3002" };
|
|
21226
|
+
options[key] = value;
|
|
21227
|
+
}
|
|
21228
|
+
return { id, name, description, create: options };
|
|
21229
|
+
}
|
|
21230
|
+
async function readWorkerTemplates(root) {
|
|
21231
|
+
const path = join21(root, ".pbot", "worker", "templates.json");
|
|
21232
|
+
const catalog = { templates: [], errors: [] };
|
|
21233
|
+
const unavailable = { ...catalog, error: "\u5F53\u524D\u5DE5\u4F5C\u533A\u7684\u52A9\u624B\u6A21\u677F\u4E0D\u53EF\u7528\u3002" };
|
|
21234
|
+
let entries;
|
|
21235
|
+
try {
|
|
21236
|
+
const file = await open(path, constants4.O_RDONLY | constants4.O_NONBLOCK);
|
|
21237
|
+
try {
|
|
21238
|
+
if (!(await file.stat()).isFile()) return unavailable;
|
|
21239
|
+
entries = JSON.parse(await file.readFile("utf8"));
|
|
21240
|
+
} finally {
|
|
21241
|
+
await file.close();
|
|
21242
|
+
}
|
|
21243
|
+
} catch (error) {
|
|
21244
|
+
if (error.code === "ENOENT") return catalog;
|
|
21245
|
+
return unavailable;
|
|
21246
|
+
}
|
|
21247
|
+
if (!object(entries)) return unavailable;
|
|
21248
|
+
for (const id of Object.keys(entries).sort()) {
|
|
21249
|
+
const result = parseTemplate(id, entries[id]);
|
|
21250
|
+
if ("message" in result) catalog.errors.push(result);
|
|
21251
|
+
else catalog.templates.push(result);
|
|
21252
|
+
}
|
|
21253
|
+
return catalog;
|
|
21254
|
+
}
|
|
21255
|
+
|
|
21183
21256
|
// src/services/workspace/workspace-preparation.ts
|
|
21184
21257
|
init_validation();
|
|
21185
21258
|
init_paths();
|
|
21186
21259
|
init_workspace_config2();
|
|
21187
21260
|
import { lstat as lstat2, mkdir as mkdir4, readFile as readFile9, writeFile as writeFile2 } from "node:fs/promises";
|
|
21188
|
-
import { join as
|
|
21261
|
+
import { join as join22 } from "node:path";
|
|
21189
21262
|
async function initializeWorkspace(root) {
|
|
21190
21263
|
const configuration = await readWorkspaceConfig(root);
|
|
21191
21264
|
if (configuration.error) throw new Error(configuration.error);
|
|
@@ -21195,22 +21268,22 @@ async function initializeWorkspace(root) {
|
|
|
21195
21268
|
var directories = ["areas", "projects", "knowledge", "providers", "scratch", "agents"];
|
|
21196
21269
|
async function prepareWorkspace(root) {
|
|
21197
21270
|
for (const part of directories) {
|
|
21198
|
-
const path =
|
|
21271
|
+
const path = join22(root, part);
|
|
21199
21272
|
await mkdir4(path, { mode: 448 }).catch((error) => {
|
|
21200
21273
|
if (error.code !== "EEXIST") throw error;
|
|
21201
21274
|
});
|
|
21202
21275
|
const entry = await lstat2(path);
|
|
21203
21276
|
requireThat(entry.isDirectory() && !entry.isSymbolicLink(), "\u5DE5\u4F5C\u533A\u76EE\u5F55\u4E0D\u80FD\u4F7F\u7528\u7B26\u53F7\u94FE\u63A5\uFF1A" + path);
|
|
21204
21277
|
}
|
|
21205
|
-
const agents = await readFile9(
|
|
21206
|
-
await writeFile2(
|
|
21278
|
+
const agents = await readFile9(join22(resourceRoot, "templates/workspace-agents.md"), "utf8");
|
|
21279
|
+
await writeFile2(join22(root, "AGENTS.md"), agents, { flag: "wx" }).catch((error) => {
|
|
21207
21280
|
if (error.code !== "EEXIST") throw error;
|
|
21208
21281
|
});
|
|
21209
21282
|
}
|
|
21210
21283
|
|
|
21211
21284
|
// src/services/workspace/workspace-skills.ts
|
|
21212
21285
|
import { readdir, readFile as readFile10 } from "node:fs/promises";
|
|
21213
|
-
import { join as
|
|
21286
|
+
import { join as join23 } from "node:path";
|
|
21214
21287
|
function unquoteYaml(value) {
|
|
21215
21288
|
const trimmed = value.trim();
|
|
21216
21289
|
if (trimmed.length >= 2 && (trimmed.startsWith('"') && trimmed.endsWith('"') || trimmed.startsWith("'") && trimmed.endsWith("'"))) {
|
|
@@ -21258,7 +21331,7 @@ function parseSkillFrontmatter(content) {
|
|
|
21258
21331
|
};
|
|
21259
21332
|
}
|
|
21260
21333
|
async function discoverWorkspaceSkills(root) {
|
|
21261
|
-
return discoverSkills(
|
|
21334
|
+
return discoverSkills(join23(root, ".agents", "skills"), ".agents/skills");
|
|
21262
21335
|
}
|
|
21263
21336
|
async function discoverSkills(skillsDir, indexPath) {
|
|
21264
21337
|
let entries;
|
|
@@ -21271,7 +21344,7 @@ async function discoverSkills(skillsDir, indexPath) {
|
|
|
21271
21344
|
const results = [];
|
|
21272
21345
|
for (const entry of entries) {
|
|
21273
21346
|
if (entry.name.startsWith(".") || !entry.isDirectory() && !entry.isSymbolicLink()) continue;
|
|
21274
|
-
const filePath =
|
|
21347
|
+
const filePath = join23(skillsDir, entry.name, "SKILL.md");
|
|
21275
21348
|
let content;
|
|
21276
21349
|
try {
|
|
21277
21350
|
content = await readFile10(filePath, "utf8");
|
|
@@ -21283,7 +21356,7 @@ async function discoverSkills(skillsDir, indexPath) {
|
|
|
21283
21356
|
results.push({
|
|
21284
21357
|
name: meta.name,
|
|
21285
21358
|
description: meta.description,
|
|
21286
|
-
path:
|
|
21359
|
+
path: join23(indexPath, entry.name, "SKILL.md")
|
|
21287
21360
|
});
|
|
21288
21361
|
}
|
|
21289
21362
|
results.sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -21345,7 +21418,7 @@ async function pluginHook(adapter, payload, replay) {
|
|
|
21345
21418
|
const includeSkills = features.skills && !event.noticesOnly;
|
|
21346
21419
|
const workspaceSkills = includeSkills && !adapter.nativeWorkspaceSkills ? await discoverWorkspaceSkills(root) : [];
|
|
21347
21420
|
if (includeSkills && adapter.indexBundledSkills) {
|
|
21348
|
-
const directory =
|
|
21421
|
+
const directory = join24(resourceRoot, "skills");
|
|
21349
21422
|
workspaceSkills.push(...await discoverSkills(directory, directory));
|
|
21350
21423
|
}
|
|
21351
21424
|
const notices = event.isSessionStart && features.history ? [...historyStartupNotices(root)] : [];
|
|
@@ -21354,7 +21427,8 @@ async function pluginHook(adapter, payload, replay) {
|
|
|
21354
21427
|
host: adapter.host,
|
|
21355
21428
|
root,
|
|
21356
21429
|
role: event.role,
|
|
21357
|
-
|
|
21430
|
+
readWorkerTemplates,
|
|
21431
|
+
coordinatorPrompt: adapter.coordinatorPrompt ?? (features.history ? "plugin-coordinator.md" : null),
|
|
21358
21432
|
includePrompts,
|
|
21359
21433
|
includeRootAgents: includePrompts && !adapter.nativeRootAgents,
|
|
21360
21434
|
...event.localRoleOnly ? { localRoleOnly: true } : {},
|
|
@@ -21396,7 +21470,7 @@ var pluginCommand2 = {
|
|
|
21396
21470
|
};
|
|
21397
21471
|
|
|
21398
21472
|
// src/extension/cli/commands/upgrade.ts
|
|
21399
|
-
import { join as
|
|
21473
|
+
import { join as join29 } from "node:path";
|
|
21400
21474
|
|
|
21401
21475
|
// src/common/package-source.ts
|
|
21402
21476
|
var import_semver5 = __toESM(require_semver2(), 1);
|
|
@@ -21421,7 +21495,7 @@ init_validation();
|
|
|
21421
21495
|
var import_semver6 = __toESM(require_semver2(), 1);
|
|
21422
21496
|
init_json();
|
|
21423
21497
|
import { readFile as readFile11 } from "node:fs/promises";
|
|
21424
|
-
import { join as
|
|
21498
|
+
import { join as join25 } from "node:path";
|
|
21425
21499
|
async function readManifestVersion4(path) {
|
|
21426
21500
|
try {
|
|
21427
21501
|
const data = JSON.parse(await readFile11(path, "utf8"));
|
|
@@ -21485,8 +21559,8 @@ var antigravityUpgrader = {
|
|
|
21485
21559
|
detail: "\u5DF2\u662F\u6700\u65B0\u7248\u672C\u3002"
|
|
21486
21560
|
};
|
|
21487
21561
|
}
|
|
21488
|
-
const pluginDir =
|
|
21489
|
-
const bundledVersion = await readManifestVersion4(
|
|
21562
|
+
const pluginDir = join25(context.packageRoot, "lib", "antigravity-plugin");
|
|
21563
|
+
const bundledVersion = await readManifestVersion4(join25(pluginDir, "plugin.json"));
|
|
21490
21564
|
if (!bundledVersion) {
|
|
21491
21565
|
return {
|
|
21492
21566
|
host: this.host,
|
|
@@ -21629,7 +21703,7 @@ var claudeUpgrader = {
|
|
|
21629
21703
|
var import_semver8 = __toESM(require_semver2(), 1);
|
|
21630
21704
|
init_json();
|
|
21631
21705
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
21632
|
-
import { join as
|
|
21706
|
+
import { join as join26 } from "node:path";
|
|
21633
21707
|
async function readManifestVersion5(path) {
|
|
21634
21708
|
try {
|
|
21635
21709
|
const data = JSON.parse(await readFile12(path, "utf8"));
|
|
@@ -21708,8 +21782,8 @@ var codexUpgrader = {
|
|
|
21708
21782
|
detail: "\u5DF2\u662F\u6700\u65B0\u7248\u672C\u3002"
|
|
21709
21783
|
};
|
|
21710
21784
|
}
|
|
21711
|
-
const marketplaceDir =
|
|
21712
|
-
const bundledVersion = await readManifestVersion5(
|
|
21785
|
+
const marketplaceDir = join26(context.packageRoot, "lib", "codex-marketplace");
|
|
21786
|
+
const bundledVersion = await readManifestVersion5(join26(marketplaceDir, "plugins", "personal-bot", ".codex-plugin", "plugin.json"));
|
|
21713
21787
|
if (!bundledVersion) {
|
|
21714
21788
|
return {
|
|
21715
21789
|
host: this.host,
|
|
@@ -21831,14 +21905,14 @@ var dshUpgrader = {
|
|
|
21831
21905
|
var import_semver10 = __toESM(require_semver2(), 1);
|
|
21832
21906
|
init_json();
|
|
21833
21907
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
21834
|
-
import { join as
|
|
21908
|
+
import { join as join27 } from "node:path";
|
|
21835
21909
|
function packageSource(entry) {
|
|
21836
21910
|
if (typeof entry === "string") return entry;
|
|
21837
21911
|
if (object(entry) && typeof entry.source === "string") return entry.source;
|
|
21838
21912
|
return void 0;
|
|
21839
21913
|
}
|
|
21840
21914
|
async function hasCustomOnlySource(workspace) {
|
|
21841
|
-
const settingsPath =
|
|
21915
|
+
const settingsPath = join27(workspace, ".pi", "settings.json");
|
|
21842
21916
|
try {
|
|
21843
21917
|
const data = JSON.parse(await readFile13(settingsPath, "utf8"));
|
|
21844
21918
|
if (!object(data) || !Array.isArray(data.packages)) return false;
|
|
@@ -21852,7 +21926,7 @@ async function hasCustomOnlySource(workspace) {
|
|
|
21852
21926
|
}
|
|
21853
21927
|
}
|
|
21854
21928
|
async function readLocalPiVersion(workspace) {
|
|
21855
|
-
const manifestPath =
|
|
21929
|
+
const manifestPath = join27(workspace, ".pi", "npm", "node_modules", "personal-bot", "package.json");
|
|
21856
21930
|
try {
|
|
21857
21931
|
const data = JSON.parse(await readFile13(manifestPath, "utf8"));
|
|
21858
21932
|
return object(data) && data.name === "personal-bot" && typeof data.version === "string" && (0, import_semver10.valid)(data.version) ? data.version : void 0;
|
|
@@ -21919,7 +21993,7 @@ var piUpgrader = {
|
|
|
21919
21993
|
var import_semver11 = __toESM(require_semver2(), 1);
|
|
21920
21994
|
init_json();
|
|
21921
21995
|
import { readFile as readFile14, realpath as realpath7 } from "node:fs/promises";
|
|
21922
|
-
import { join as
|
|
21996
|
+
import { join as join28 } from "node:path";
|
|
21923
21997
|
async function readManifestVersion6(path) {
|
|
21924
21998
|
try {
|
|
21925
21999
|
const data = JSON.parse(await readFile14(path, "utf8"));
|
|
@@ -22012,8 +22086,8 @@ var qoderUpgrader = {
|
|
|
22012
22086
|
detail: "\u5DF2\u662F\u6700\u65B0\u7248\u672C\u3002"
|
|
22013
22087
|
};
|
|
22014
22088
|
}
|
|
22015
|
-
const pluginDir =
|
|
22016
|
-
const bundledVersion = await readManifestVersion6(
|
|
22089
|
+
const pluginDir = join28(context.packageRoot, "lib", "qoder-plugin");
|
|
22090
|
+
const bundledVersion = await readManifestVersion6(join28(pluginDir, ".qoder-plugin", "plugin.json"));
|
|
22017
22091
|
if (!bundledVersion) {
|
|
22018
22092
|
return {
|
|
22019
22093
|
host: this.host,
|
|
@@ -22248,7 +22322,7 @@ var upgradeCommand = {
|
|
|
22248
22322
|
PBOT_UPGRADING_CLI: targetVersion,
|
|
22249
22323
|
PBOT_UPGRADING_PREVIOUS_VERSION: packageVersion
|
|
22250
22324
|
};
|
|
22251
|
-
return execCliEntry(
|
|
22325
|
+
return execCliEntry(join29(cliResult.globalDirectory, "bin", "pbot.mjs"), ctx.rawArgs, nextEnv);
|
|
22252
22326
|
}
|
|
22253
22327
|
cli = {
|
|
22254
22328
|
state: cliResult.state,
|