@agentuity/opencode 0.1.33 → 0.1.35

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.
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/plugin/hooks/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG9D,MAAM,WAAW,SAAS;IACzB,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1D;AAoBD,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,CAwDlF"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/plugin/hooks/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG9D,MAAM,WAAW,SAAS;IACzB,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1D;AA6BD,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,CAsElF"}
@@ -5,6 +5,14 @@ const CLOUD_TOOL_PREFIXES = [
5
5
  'agentuity.vector',
6
6
  'agentuity.sandbox',
7
7
  ];
8
+ /**
9
+ * Get the Agentuity profile to use for CLI commands.
10
+ * Defaults to 'production' for safety, but can be overridden via AGENTUITY_CODER_PROFILE.
11
+ */
12
+ function getCoderProfile() {
13
+ const profile = process.env.AGENTUITY_CODER_PROFILE?.trim();
14
+ return profile || 'production';
15
+ }
8
16
  /** Cloud service detection for bash commands */
9
17
  const CLOUD_SERVICES = {
10
18
  'agentuity cloud kv': { name: 'KV Storage', emoji: '🗄️' },
@@ -50,6 +58,19 @@ export function createToolHooks(ctx, config) {
50
58
  });
51
59
  return;
52
60
  }
61
+ // Inject AGENTUITY_PROFILE environment variable
62
+ const profile = getCoderProfile();
63
+ let modifiedCommand;
64
+ // Check if AGENTUITY_PROFILE already exists (anywhere in the command)
65
+ if (/AGENTUITY_PROFILE=\S+/.test(command)) {
66
+ // Replace all existing AGENTUITY_PROFILE occurrences to enforce our profile
67
+ modifiedCommand = command.replace(/AGENTUITY_PROFILE=\S+/g, `AGENTUITY_PROFILE=${profile}`);
68
+ }
69
+ else {
70
+ // Prepend AGENTUITY_PROFILE
71
+ modifiedCommand = `AGENTUITY_PROFILE=${profile} ${command}`;
72
+ }
73
+ setBashCommand(input, modifiedCommand);
53
74
  // Show toast for cloud service usage
54
75
  const service = detectCloudService(command);
55
76
  if (service) {
@@ -88,6 +109,25 @@ function extractBashCommand(input) {
88
109
  }
89
110
  return undefined;
90
111
  }
112
+ /**
113
+ * Set the bash command in the input object.
114
+ * Handles both direct command property and args.command structures.
115
+ */
116
+ function setBashCommand(input, command) {
117
+ if (typeof input !== 'object' || input === null)
118
+ return;
119
+ const inp = input;
120
+ // Update the command in the same location it was found
121
+ if (typeof inp.command === 'string') {
122
+ inp.command = command;
123
+ }
124
+ else if (typeof inp.args === 'object' && inp.args !== null) {
125
+ const args = inp.args;
126
+ if (typeof args.command === 'string') {
127
+ args.command = command;
128
+ }
129
+ }
130
+ }
91
131
  function detectCloudService(command) {
92
132
  for (const [pattern, service] of Object.entries(CLOUD_SERVICES)) {
93
133
  if (command.includes(pattern)) {
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","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AC;QAChB,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,SAAS,WAAW,CAAC,QAAgB;IACpC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED,0FAA0F;AAC1F,SAAS,gBAAgB,CAAC,OAAe,EAAE,eAAyB;IACnE,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE,CAAC;QACvC,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/B,OAAO,OAAO,CAAC;QAChB,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentuity/opencode",
3
- "version": "0.1.33",
3
+ "version": "0.1.35",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Agentuity employees and contributors",
6
6
  "description": "Agentuity Open Code plugin with specialized AI coding agents",
@@ -40,11 +40,11 @@
40
40
  "prepublishOnly": "bun run clean && bun run build"
41
41
  },
42
42
  "dependencies": {
43
- "@agentuity/core": "0.1.33",
43
+ "@agentuity/core": "0.1.35",
44
44
  "zod": "^4.3.5"
45
45
  },
46
46
  "devDependencies": {
47
- "@agentuity/test-utils": "0.1.33",
47
+ "@agentuity/test-utils": "0.1.35",
48
48
  "@types/bun": "latest",
49
49
  "bun-types": "latest",
50
50
  "typescript": "^5.9.0"
@@ -13,6 +13,15 @@ const CLOUD_TOOL_PREFIXES = [
13
13
  'agentuity.sandbox',
14
14
  ];
15
15
 
16
+ /**
17
+ * Get the Agentuity profile to use for CLI commands.
18
+ * Defaults to 'production' for safety, but can be overridden via AGENTUITY_CODER_PROFILE.
19
+ */
20
+ function getCoderProfile(): string {
21
+ const profile = process.env.AGENTUITY_CODER_PROFILE?.trim();
22
+ return profile || 'production';
23
+ }
24
+
16
25
  /** Cloud service detection for bash commands */
17
26
  const CLOUD_SERVICES: Record<string, { name: string; emoji: string }> = {
18
27
  'agentuity cloud kv': { name: 'KV Storage', emoji: '🗄️' },
@@ -63,6 +72,20 @@ export function createToolHooks(ctx: PluginContext, config: CoderConfig): ToolHo
63
72
  return;
64
73
  }
65
74
 
75
+ // Inject AGENTUITY_PROFILE environment variable
76
+ const profile = getCoderProfile();
77
+ let modifiedCommand: string;
78
+
79
+ // Check if AGENTUITY_PROFILE already exists (anywhere in the command)
80
+ if (/AGENTUITY_PROFILE=\S+/.test(command)) {
81
+ // Replace all existing AGENTUITY_PROFILE occurrences to enforce our profile
82
+ modifiedCommand = command.replace(/AGENTUITY_PROFILE=\S+/g, `AGENTUITY_PROFILE=${profile}`);
83
+ } else {
84
+ // Prepend AGENTUITY_PROFILE
85
+ modifiedCommand = `AGENTUITY_PROFILE=${profile} ${command}`;
86
+ }
87
+ setBashCommand(input, modifiedCommand);
88
+
66
89
  // Show toast for cloud service usage
67
90
  const service = detectCloudService(command);
68
91
  if (service) {
@@ -103,6 +126,25 @@ function extractBashCommand(input: unknown): string | undefined {
103
126
  return undefined;
104
127
  }
105
128
 
129
+ /**
130
+ * Set the bash command in the input object.
131
+ * Handles both direct command property and args.command structures.
132
+ */
133
+ function setBashCommand(input: unknown, command: string): void {
134
+ if (typeof input !== 'object' || input === null) return;
135
+ const inp = input as Record<string, unknown>;
136
+
137
+ // Update the command in the same location it was found
138
+ if (typeof inp.command === 'string') {
139
+ inp.command = command;
140
+ } else if (typeof inp.args === 'object' && inp.args !== null) {
141
+ const args = inp.args as Record<string, unknown>;
142
+ if (typeof args.command === 'string') {
143
+ args.command = command;
144
+ }
145
+ }
146
+ }
147
+
106
148
  function detectCloudService(command: string): { name: string; emoji: string } | null {
107
149
  for (const [pattern, service] of Object.entries(CLOUD_SERVICES)) {
108
150
  if (command.includes(pattern)) {