@agent-os-sdk/client 0.8.0 → 0.8.1
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":"presets.d.ts","sourceRoot":"","sources":["../../src/modules/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIlD,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;IAClD,WAAW,EAAE,UAAU,GAAG,MAAM,CAAC;IACjC,GAAG,CAAC,EAAE;QACJ,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,QAAQ,CAAC,EAAE,KAAK,CAAC;QACf,aAAa,EAAE,MAAM,CAAC;QACtB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/modules/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIlD,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;IAClD,WAAW,EAAE,UAAU,GAAG,MAAM,CAAC;IACjC,GAAG,CAAC,EAAE;QACJ,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,QAAQ,CAAC,EAAE,KAAK,CAAC;QACf,aAAa,EAAE,MAAM,CAAC;QACtB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAwED,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAY;IAC3B,OAAO,CAAC,QAAQ,CAA+B;IAG/C,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,SAAS,CAAiB;gBAEtB,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAOjE,WAAW,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;CA8DnF"}
|
package/dist/modules/presets.js
CHANGED
|
@@ -53,6 +53,15 @@ function generateGraphSpec(config) {
|
|
|
53
53
|
triggers,
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
+
function generateUUID() {
|
|
57
|
+
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
|
|
58
|
+
return crypto.randomUUID();
|
|
59
|
+
}
|
|
60
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
61
|
+
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
|
62
|
+
return v.toString(16);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
56
65
|
export class PresetsModule {
|
|
57
66
|
_client;
|
|
58
67
|
_headers;
|
|
@@ -72,7 +81,10 @@ export class PresetsModule {
|
|
|
72
81
|
trigger_type: config.trigger_type,
|
|
73
82
|
output_type: config.output_type,
|
|
74
83
|
});
|
|
75
|
-
const { data: agent, error: createError } = await this._agents.create({
|
|
84
|
+
const { data: agent, error: createError } = await this._agents.create({
|
|
85
|
+
name: config.name,
|
|
86
|
+
idempotency_key: generateUUID()
|
|
87
|
+
});
|
|
76
88
|
if (createError || !agent) {
|
|
77
89
|
console.error("[AgentOS SDK] Failed to create agent:", createError);
|
|
78
90
|
return null;
|
package/package.json
CHANGED
package/src/modules/presets.ts
CHANGED
|
@@ -85,6 +85,17 @@ function generateGraphSpec(config: AgentTemplateConfig): Record<string, unknown>
|
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
|
|
89
|
+
function generateUUID(): string {
|
|
90
|
+
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
|
|
91
|
+
return crypto.randomUUID();
|
|
92
|
+
}
|
|
93
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
94
|
+
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
|
95
|
+
return v.toString(16);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
88
99
|
export class PresetsModule {
|
|
89
100
|
private _client: RawClient;
|
|
90
101
|
private _headers: () => Record<string, string>;
|
|
@@ -108,7 +119,10 @@ export class PresetsModule {
|
|
|
108
119
|
output_type: config.output_type,
|
|
109
120
|
});
|
|
110
121
|
|
|
111
|
-
const { data: agent, error: createError } = await this._agents.create({
|
|
122
|
+
const { data: agent, error: createError } = await this._agents.create({
|
|
123
|
+
name: config.name,
|
|
124
|
+
idempotency_key: generateUUID()
|
|
125
|
+
});
|
|
112
126
|
|
|
113
127
|
if (createError || !agent) {
|
|
114
128
|
console.error("[AgentOS SDK] Failed to create agent:", createError);
|