@dyyz1993/pi-coding-agent 0.74.20 → 0.74.21

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.
Files changed (37) hide show
  1. package/dist/core/agent-session.d.ts +4 -0
  2. package/dist/core/agent-session.d.ts.map +1 -1
  3. package/dist/core/agent-session.js +39 -1
  4. package/dist/core/agent-session.js.map +1 -1
  5. package/dist/core/agent-types.d.ts +7 -0
  6. package/dist/core/agent-types.d.ts.map +1 -1
  7. package/dist/core/agent-types.js +46 -2
  8. package/dist/core/agent-types.js.map +1 -1
  9. package/dist/core/extensions/loader.d.ts.map +1 -1
  10. package/dist/core/extensions/loader.js +7 -2
  11. package/dist/core/extensions/loader.js.map +1 -1
  12. package/dist/core/extensions/runner.d.ts.map +1 -1
  13. package/dist/core/extensions/runner.js +5 -6
  14. package/dist/core/extensions/runner.js.map +1 -1
  15. package/dist/core/resource-loader.d.ts.map +1 -1
  16. package/dist/core/resource-loader.js +2 -2
  17. package/dist/core/resource-loader.js.map +1 -1
  18. package/dist/core/settings-manager.d.ts +1 -0
  19. package/dist/core/settings-manager.d.ts.map +1 -1
  20. package/dist/core/settings-manager.js +5 -0
  21. package/dist/core/settings-manager.js.map +1 -1
  22. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  23. package/dist/modes/interactive/interactive-mode.js +1 -1
  24. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  25. package/dist/modes/rpc/rpc-client-types.d.ts.map +1 -1
  26. package/dist/modes/rpc/rpc-client-types.js.map +1 -1
  27. package/dist/modes/rpc/rpc-client.d.ts +18 -0
  28. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  29. package/dist/modes/rpc/rpc-client.js +12 -0
  30. package/dist/modes/rpc/rpc-client.js.map +1 -1
  31. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  32. package/dist/modes/rpc/rpc-mode.js +33 -0
  33. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  34. package/dist/modes/rpc/rpc-types.d.ts +43 -0
  35. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  36. package/dist/modes/rpc/rpc-types.js.map +1 -1
  37. package/package.json +4 -4
@@ -36,10 +36,10 @@ import { InternalGit } from "./file-store/internal-git.js";
36
36
  import { McpManager } from "./mcp/mcp-manager.js";
37
37
  import { createMcpToolDefinition } from "./mcp/tool-converter.js";
38
38
  import { resolveModelAlias } from "./model-resolver.js";
39
- import { getCwdDataDir, getGlobalDataDir, getProjectDataDir, getSessionDataDir, resolveProjectIdentity } from "./storage.js";
40
39
  import { expandPromptTemplate } from "./prompt-templates.js";
41
40
  import { CURRENT_SESSION_VERSION, getLatestCompactionEntry } from "./session-manager.js";
42
41
  import { createSyntheticSourceInfo } from "./source-info.js";
42
+ import { getCwdDataDir, getGlobalDataDir, getProjectDataDir, getSessionDataDir, resolveProjectIdentity, } from "./storage.js";
43
43
  import { buildSystemPrompt } from "./system-prompt.js";
44
44
  import { createLocalBashOperations } from "./tools/bash.js";
45
45
  import { createAllToolDefinitions, createTool } from "./tools/index.js";
@@ -124,6 +124,8 @@ export class AgentSession {
124
124
  _mcpToolDefinitions = new Map();
125
125
  _mcpServerScopes = new Map();
126
126
  _noMcp;
127
+ _currentAgentName = null;
128
+ _currentAgentVariables = {};
127
129
  _tierModels = {};
128
130
  // Tool registry for extension getTools/setTools
129
131
  _toolRegistry = new Map();
@@ -266,6 +268,7 @@ export class AgentSession {
266
268
  toolName: toolCall.name,
267
269
  toolCallId: toolCall.id,
268
270
  input: args,
271
+ variables: this._currentAgentVariables,
269
272
  });
270
273
  }
271
274
  catch (err) {
@@ -708,6 +711,41 @@ export class AgentSession {
708
711
  this._baseSystemPrompt = this._rebuildSystemPrompt(validToolNames);
709
712
  this.agent.state.systemPrompt = this._baseSystemPrompt;
710
713
  }
714
+ async applyAgentConfig(agent) {
715
+ this._currentAgentName = agent.name;
716
+ this._currentAgentVariables = {
717
+ ...(agent.variables ?? {}),
718
+ };
719
+ if (agent.permissionMode) {
720
+ this._currentAgentVariables["permissionMode"] = agent.permissionMode;
721
+ }
722
+ if (agent.name) {
723
+ this._currentAgentVariables["agentName"] = agent.name;
724
+ }
725
+ if (agent.disallowedTools && agent.disallowedTools.length > 0) {
726
+ this._currentAgentVariables["disallowedTools"] = agent.disallowedTools.join(",");
727
+ }
728
+ if (agent.tools && agent.tools.length > 0) {
729
+ this._currentAgentVariables["allowedTools"] = agent.tools.join(",");
730
+ }
731
+ if (agent.thinkingLevel) {
732
+ this.setThinkingLevel(agent.thinkingLevel);
733
+ }
734
+ if (agent.tools && agent.tools.length > 0) {
735
+ this.setActiveToolsByName(agent.tools);
736
+ }
737
+ if (agent.systemPrompt) {
738
+ const appendParts = [];
739
+ if (this._resourceLoader.getAppendSystemPrompt().length > 0) {
740
+ appendParts.push(...this._resourceLoader.getAppendSystemPrompt());
741
+ }
742
+ appendParts.push(agent.systemPrompt);
743
+ this._baseSystemPrompt = this._rebuildSystemPrompt(this.getActiveToolNames());
744
+ }
745
+ }
746
+ getCurrentAgent() {
747
+ return this._currentAgentName;
748
+ }
711
749
  /** Whether compaction or branch summarization is currently running */
712
750
  get isCompacting() {
713
751
  return (this._autoCompactionAbortController !== undefined ||