Skip to content

Commit 67d4f38

Browse files
committed
fix
1 parent 8b5cd3f commit 67d4f38

File tree

8 files changed

+46
-41
lines changed

8 files changed

+46
-41
lines changed

golem-common/src/base_model/worker.rs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,13 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
use super::agent::AgentTypeName;
16-
use super::component_metadata::ComponentMetadata;
1715
use crate::base_model::account::AccountId;
1816
use crate::base_model::component::{ComponentFilePermissions, ComponentRevision, PluginPriority};
1917
use crate::base_model::environment::EnvironmentId;
2018
use crate::base_model::oplog::WorkerResourceId;
2119
use crate::base_model::regions::OplogRegion;
2220
use crate::base_model::{OplogIndex, Timestamp, WorkerId, WorkerResourceDescription, WorkerStatus};
23-
use crate::model::agent::{ConfigKeyValueType, ConfigValueType};
2421
use crate::{declare_enums, declare_structs, declare_unions};
25-
use golem_wasm::ValueAndType;
2622
use golem_wasm_derive::{FromValue, IntoValue};
2723
use std::collections::{BTreeMap, HashMap, HashSet};
2824
use std::fmt::{Display, Formatter};
@@ -74,42 +70,6 @@ pub struct UntypedParsedWorkerCreationLocalAgentConfigEntry {
7470
pub value: golem_wasm::Value,
7571
}
7672

77-
impl UntypedParsedWorkerCreationLocalAgentConfigEntry {
78-
pub fn enrich_with_type(
79-
self,
80-
component_metadata: &ComponentMetadata,
81-
agent_type_name: Option<&AgentTypeName>,
82-
) -> Result<ParsedWorkerCreationLocalAgentConfigEntry, String> {
83-
let agent_type_name = agent_type_name.ok_or_else(|| {
84-
"cannot enrich local agent config for non-agentic workers".to_string()
85-
})?;
86-
87-
let value_type = component_metadata
88-
.find_agent_type_by_name(agent_type_name)
89-
.ok_or("did not find expected agent type in the metadata")?
90-
.config
91-
.into_iter()
92-
.find_map(|c| match c {
93-
ConfigKeyValueType {
94-
key,
95-
value: ConfigValueType::Local(inner),
96-
} if key == self.key => Some(inner),
97-
_ => None,
98-
})
99-
.ok_or_else(|| {
100-
format!(
101-
"did not find config key {} in the metadata",
102-
self.key.join(".")
103-
)
104-
})?;
105-
106-
Ok(ParsedWorkerCreationLocalAgentConfigEntry {
107-
key: self.key,
108-
value: ValueAndType::new(self.value, value_type.value),
109-
})
110-
}
111-
}
112-
11373
declare_structs! {
11474
pub struct WorkerCreationLocalAgentConfigEntry {
11575
pub key: Vec<String>,

golem-common/src/model/worker.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,47 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
use super::agent::AgentTypeName;
16+
use super::component_metadata::ComponentMetadata;
1517
pub use crate::base_model::worker::*;
18+
use crate::model::agent::{ConfigKeyValueType, ConfigValueType};
19+
use golem_wasm::ValueAndType;
20+
21+
impl UntypedParsedWorkerCreationLocalAgentConfigEntry {
22+
pub fn enrich_with_type(
23+
self,
24+
component_metadata: &ComponentMetadata,
25+
agent_type_name: Option<&AgentTypeName>,
26+
) -> Result<ParsedWorkerCreationLocalAgentConfigEntry, String> {
27+
let agent_type_name = agent_type_name.ok_or_else(|| {
28+
"cannot enrich local agent config for non-agentic workers".to_string()
29+
})?;
30+
31+
let value_type = component_metadata
32+
.find_agent_type_by_name(agent_type_name)
33+
.ok_or("did not find expected agent type in the metadata")?
34+
.config
35+
.into_iter()
36+
.find_map(|c| match c {
37+
ConfigKeyValueType {
38+
key,
39+
value: ConfigValueType::Local(inner),
40+
} if key == self.key => Some(inner),
41+
_ => None,
42+
})
43+
.ok_or_else(|| {
44+
format!(
45+
"did not find config key {} in the metadata",
46+
self.key.join(".")
47+
)
48+
})?;
49+
50+
Ok(ParsedWorkerCreationLocalAgentConfigEntry {
51+
key: self.key,
52+
value: ValueAndType::new(self.value, value_type.value),
53+
})
54+
}
55+
}
1656

1757
mod protobuf {
1858
use super::{

sdks/ts/packages/golem-ts-sdk/types/golem_api_1_5_0_oplog.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ declare module 'golem:api/oplog@1.5.0' {
2525
export type AccountId = golemCore150Types.AccountId;
2626
export type DataValue = golemCore150Types.DataValue;
2727
export type DataSchema = golemCore150Types.DataSchema;
28+
export type WitValue = golemCore150Types.WitValue;
2829
export type ComponentRevision = golemApi150Host.ComponentRevision;
2930
export type OplogIndex = golemApi150Host.OplogIndex;
3031
export type PersistenceLevel = golemApi150Host.PersistenceLevel;
@@ -78,6 +79,10 @@ declare module 'golem:api/oplog@1.5.0' {
7879
version: string;
7980
parameters: [string, string][];
8081
};
82+
export type RawLocalAgentConfigEntry = {
83+
key: string[];
84+
value: WitValue;
85+
};
8186
export type LocalAgentConfigEntry = {
8287
key: string[];
8388
value: ValueAndType;
@@ -405,7 +410,7 @@ declare module 'golem:api/oplog@1.5.0' {
405410
initialTotalLinearMemorySize: bigint;
406411
initialActivePlugins: number[];
407412
configVars: [string, string][];
408-
localAgentConfig: LocalAgentConfigEntry[];
413+
localAgentConfig: RawLocalAgentConfigEntry[];
409414
originalPhantomId?: Uuid;
410415
};
411416
export type RawHostCallParameters = {
700 Bytes
Binary file not shown.
700 Bytes
Binary file not shown.
700 Bytes
Binary file not shown.
700 Bytes
Binary file not shown.
700 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)