@agenthifive/openclaw 0.3.0 → 0.3.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.
- package/dist/register.js +1 -1
- package/dist/runtime.d.ts +4 -6
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +27 -21
- package/dist/runtime.js.map +1 -1
- package/package.json +1 -1
package/dist/register.js
CHANGED
|
@@ -23,7 +23,7 @@ import { verifyPatches } from "./patch-verify.js";
|
|
|
23
23
|
// ---------------------------------------------------------------------------
|
|
24
24
|
const DEFAULT_BASE_URL = "https://app.agenthifive.com";
|
|
25
25
|
const PLUGIN_ID = "agenthifive";
|
|
26
|
-
const PLUGIN_VERSION = "0.3.
|
|
26
|
+
const PLUGIN_VERSION = "0.3.1";
|
|
27
27
|
// ---------------------------------------------------------------------------
|
|
28
28
|
// Module-scoped singletons (lifecycle managed by register/stop)
|
|
29
29
|
// ---------------------------------------------------------------------------
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Runtime exports for OpenClaw core patches.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* pulling in the full plugin. When the plugin is not installed, the dynamic
|
|
9
|
-
* import fails silently and the patch is a no-op.
|
|
4
|
+
* State is shared via globalThis.__ah5_runtime to avoid ESM module cache
|
|
5
|
+
* issues — the plugin (loaded from extensions/) and the patch (in OpenClaw's
|
|
6
|
+
* dist/) may get different module instances despite importing the same URL.
|
|
7
|
+
* Using globalThis guarantees a single shared state within the process.
|
|
10
8
|
*
|
|
11
9
|
* Separate entry point from index.ts so patches import only what they need.
|
|
12
10
|
*/
|
package/dist/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAM9D;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,gBAAgB,GAAG,SAAS,GAAG,eAAe,CAAC;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;CACtC,CAAC;AA8BF;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAE9D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI,GAAG,IAAI,CAE/E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAE7D;AAMD;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,IAAI,CAEnD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAkBzC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAGvC"}
|
package/dist/runtime.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Runtime exports for OpenClaw core patches.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* pulling in the full plugin. When the plugin is not installed, the dynamic
|
|
9
|
-
* import fails silently and the patch is a no-op.
|
|
4
|
+
* State is shared via globalThis.__ah5_runtime to avoid ESM module cache
|
|
5
|
+
* issues — the plugin (loaded from extensions/) and the patch (in OpenClaw's
|
|
6
|
+
* dist/) may get different module instances despite importing the same URL.
|
|
7
|
+
* Using globalThis guarantees a single shared state within the process.
|
|
10
8
|
*
|
|
11
9
|
* Separate entry point from index.ts so patches import only what they need.
|
|
12
10
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
const GLOBAL_KEY = "__ah5_runtime";
|
|
12
|
+
function getState() {
|
|
13
|
+
const g = globalThis;
|
|
14
|
+
if (!g[GLOBAL_KEY]) {
|
|
15
|
+
g[GLOBAL_KEY] = {
|
|
16
|
+
vaultBearerToken: null,
|
|
17
|
+
credentialProvider: null,
|
|
18
|
+
proxiedProviders: [],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return g[GLOBAL_KEY];
|
|
22
|
+
}
|
|
19
23
|
// ---------------------------------------------------------------------------
|
|
20
24
|
// Setup (called by register.ts)
|
|
21
25
|
// ---------------------------------------------------------------------------
|
|
@@ -24,19 +28,19 @@ let _proxiedProviders = [];
|
|
|
24
28
|
* Sets the vault bearer token getter for Tier 0 proxied providers.
|
|
25
29
|
*/
|
|
26
30
|
export function setVaultBearerToken(token) {
|
|
27
|
-
|
|
31
|
+
getState().vaultBearerToken = token;
|
|
28
32
|
}
|
|
29
33
|
/**
|
|
30
34
|
* Called by register.ts to set the credential provider for Tier 0.5 resolution.
|
|
31
35
|
*/
|
|
32
36
|
export function setCredentialProvider(provider) {
|
|
33
|
-
|
|
37
|
+
getState().credentialProvider = provider;
|
|
34
38
|
}
|
|
35
39
|
/**
|
|
36
40
|
* Called by register.ts to set the list of providers that should use vault bearer tokens.
|
|
37
41
|
*/
|
|
38
42
|
export function setProxiedProviders(providers) {
|
|
39
|
-
|
|
43
|
+
getState().proxiedProviders = providers;
|
|
40
44
|
}
|
|
41
45
|
// ---------------------------------------------------------------------------
|
|
42
46
|
// Patch-facing API
|
|
@@ -46,13 +50,13 @@ export function setProxiedProviders(providers) {
|
|
|
46
50
|
* Returns null if the plugin is not initialized or no token is available.
|
|
47
51
|
*/
|
|
48
52
|
export function getVaultBearerToken() {
|
|
49
|
-
return
|
|
53
|
+
return getState().vaultBearerToken;
|
|
50
54
|
}
|
|
51
55
|
/**
|
|
52
56
|
* Get the list of providers configured for vault token proxying.
|
|
53
57
|
*/
|
|
54
58
|
export function getProxiedProviders() {
|
|
55
|
-
return
|
|
59
|
+
return getState().proxiedProviders;
|
|
56
60
|
}
|
|
57
61
|
/**
|
|
58
62
|
* Resolve credentials via the configured credential provider chain.
|
|
@@ -62,19 +66,20 @@ export function getProxiedProviders() {
|
|
|
62
66
|
* and the internal CredentialProvider interface.
|
|
63
67
|
*/
|
|
64
68
|
export async function resolveCredential(query) {
|
|
65
|
-
|
|
69
|
+
const state = getState();
|
|
70
|
+
if (!state.credentialProvider)
|
|
66
71
|
return null;
|
|
67
72
|
const internalQuery = {
|
|
68
73
|
provider: query.provider,
|
|
69
74
|
};
|
|
70
75
|
if (query.fields)
|
|
71
76
|
internalQuery.scopes = query.fields;
|
|
72
|
-
const result = await
|
|
77
|
+
const result = await state.credentialProvider.resolve(internalQuery);
|
|
73
78
|
if (!result)
|
|
74
79
|
return null;
|
|
75
80
|
return {
|
|
76
81
|
apiKey: result.token,
|
|
77
|
-
source: `credential-provider:${
|
|
82
|
+
source: `credential-provider:${state.credentialProvider.id}`,
|
|
78
83
|
mode: "api-key",
|
|
79
84
|
};
|
|
80
85
|
}
|
|
@@ -82,6 +87,7 @@ export async function resolveCredential(query) {
|
|
|
82
87
|
* Check whether the runtime has been initialized (plugin is loaded and auth is ready).
|
|
83
88
|
*/
|
|
84
89
|
export function isInitialized() {
|
|
85
|
-
|
|
90
|
+
const state = getState();
|
|
91
|
+
return state.vaultBearerToken !== null || state.credentialProvider !== null;
|
|
86
92
|
}
|
|
87
93
|
//# sourceMappingURL=runtime.js.map
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAsCH,MAAM,UAAU,GAAG,eAAwB,CAAC;AAE5C,SAAS,QAAQ;IACf,MAAM,CAAC,GAAG,UAAqC,CAAC;IAChD,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;QACnB,CAAC,CAAC,UAAU,CAAC,GAAG;YACd,gBAAgB,EAAE,IAAI;YACtB,kBAAkB,EAAE,IAAI;YACxB,gBAAgB,EAAE,EAAE;SACrB,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,CAAC,UAAU,CAAoB,CAAC;AAC1C,CAAC;AAED,8EAA8E;AAC9E,gCAAgC;AAChC,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAoB;IACtD,QAAQ,EAAE,CAAC,gBAAgB,GAAG,KAAK,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAmC;IACvE,QAAQ,EAAE,CAAC,kBAAkB,GAAG,QAAQ,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAmB;IACrD,QAAQ,EAAE,CAAC,gBAAgB,GAAG,SAAS,CAAC;AAC1C,CAAC;AAED,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,QAAQ,EAAE,CAAC,gBAAgB,C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