@owney/sdk 0.7.12-beta.0 → 0.7.12-beta.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/index.cjs +41 -12
- package/dist/index.d.cts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +41 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3606,12 +3606,7 @@ var OwneySDK = class {
|
|
|
3606
3606
|
this.activeAgents.add(id);
|
|
3607
3607
|
}
|
|
3608
3608
|
state.chainId = chainId;
|
|
3609
|
-
|
|
3610
|
-
agents.map(async (agent) => {
|
|
3611
|
-
await agent.activateAgent(state, chainId);
|
|
3612
|
-
await this.applyOrgPolicyTo(agent, state, chainId);
|
|
3613
|
-
})
|
|
3614
|
-
).catch((error) => {
|
|
3609
|
+
this.activateAgentsInTurn(agents, state, chainId).catch((error) => {
|
|
3615
3610
|
console.error("activateAgent background init failed:", error);
|
|
3616
3611
|
});
|
|
3617
3612
|
return;
|
|
@@ -3634,14 +3629,48 @@ var OwneySDK = class {
|
|
|
3634
3629
|
const enabledCompatible = compatible.filter(
|
|
3635
3630
|
(agent) => !this.isAgentDisabled(agent.id)
|
|
3636
3631
|
);
|
|
3637
|
-
|
|
3638
|
-
|
|
3632
|
+
this.activateAgentsInTurn(enabledCompatible, state, chainId).catch(
|
|
3633
|
+
(error) => {
|
|
3634
|
+
console.error("activateAgent background init failed:", error);
|
|
3635
|
+
}
|
|
3636
|
+
);
|
|
3637
|
+
}
|
|
3638
|
+
/**
|
|
3639
|
+
* Activate agents ONE AT A TIME, each followed by its org policy.
|
|
3640
|
+
*
|
|
3641
|
+
* Every agent opens its activation with its own wallet signature — Zyfai's
|
|
3642
|
+
* SIWX (exchanged for a JWT) and SurfLiquid's SIWE (exchanged for an httpOnly
|
|
3643
|
+
* cookie). Run in parallel, that puts two `personal_sign` requests on one
|
|
3644
|
+
* wallet connection in the same instant. Over WalletConnect both are
|
|
3645
|
+
* delivered to the wallet, which renders one signing request at a time and
|
|
3646
|
+
* queues or silently drops the other: neither promise settles, so activation
|
|
3647
|
+
* hangs until the caller's timeout with no prompt the user can act on. The
|
|
3648
|
+
* single-agent era never hit this — there was no second prompt to collide
|
|
3649
|
+
* with — so it appeared the moment a second agent became eligible.
|
|
3650
|
+
*
|
|
3651
|
+
* Serializing costs no real wall-clock: the user can only approve one prompt
|
|
3652
|
+
* at a time anyway.
|
|
3653
|
+
*
|
|
3654
|
+
* Every agent is attempted even if an earlier one fails, so one declined
|
|
3655
|
+
* signature can't deny the remaining agents their turn. The first failure is
|
|
3656
|
+
* rethrown (matching the previous `Promise.all` rejection) once all agents
|
|
3657
|
+
* have had a chance to activate.
|
|
3658
|
+
*/
|
|
3659
|
+
async activateAgentsInTurn(agents, state, chainId) {
|
|
3660
|
+
let firstError = null;
|
|
3661
|
+
for (const agent of agents) {
|
|
3662
|
+
try {
|
|
3639
3663
|
await agent.activateAgent(state, chainId);
|
|
3640
3664
|
await this.applyOrgPolicyTo(agent, state, chainId);
|
|
3641
|
-
})
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3665
|
+
} catch (error) {
|
|
3666
|
+
if (firstError === null) {
|
|
3667
|
+
firstError = error;
|
|
3668
|
+
} else {
|
|
3669
|
+
console.error(`activateAgent(${agent.id}) failed:`, error);
|
|
3670
|
+
}
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
if (firstError !== null) throw firstError;
|
|
3645
3674
|
}
|
|
3646
3675
|
/**
|
|
3647
3676
|
* Deposit funds into a specific agent, or split equally across all agents if agentId is omitted.
|
package/dist/index.d.cts
CHANGED
|
@@ -539,6 +539,28 @@ declare class OwneySDK {
|
|
|
539
539
|
* throws before activating any agent.
|
|
540
540
|
*/
|
|
541
541
|
activateAgent(chainId: number, agentId?: AgentId[]): Promise<void>;
|
|
542
|
+
/**
|
|
543
|
+
* Activate agents ONE AT A TIME, each followed by its org policy.
|
|
544
|
+
*
|
|
545
|
+
* Every agent opens its activation with its own wallet signature — Zyfai's
|
|
546
|
+
* SIWX (exchanged for a JWT) and SurfLiquid's SIWE (exchanged for an httpOnly
|
|
547
|
+
* cookie). Run in parallel, that puts two `personal_sign` requests on one
|
|
548
|
+
* wallet connection in the same instant. Over WalletConnect both are
|
|
549
|
+
* delivered to the wallet, which renders one signing request at a time and
|
|
550
|
+
* queues or silently drops the other: neither promise settles, so activation
|
|
551
|
+
* hangs until the caller's timeout with no prompt the user can act on. The
|
|
552
|
+
* single-agent era never hit this — there was no second prompt to collide
|
|
553
|
+
* with — so it appeared the moment a second agent became eligible.
|
|
554
|
+
*
|
|
555
|
+
* Serializing costs no real wall-clock: the user can only approve one prompt
|
|
556
|
+
* at a time anyway.
|
|
557
|
+
*
|
|
558
|
+
* Every agent is attempted even if an earlier one fails, so one declined
|
|
559
|
+
* signature can't deny the remaining agents their turn. The first failure is
|
|
560
|
+
* rethrown (matching the previous `Promise.all` rejection) once all agents
|
|
561
|
+
* have had a chance to activate.
|
|
562
|
+
*/
|
|
563
|
+
private activateAgentsInTurn;
|
|
542
564
|
/**
|
|
543
565
|
* Deposit funds into a specific agent, or split equally across all agents if agentId is omitted.
|
|
544
566
|
* Validates that the asset is supported and amount meets minimums for the target agent(s).
|
package/dist/index.d.ts
CHANGED
|
@@ -539,6 +539,28 @@ declare class OwneySDK {
|
|
|
539
539
|
* throws before activating any agent.
|
|
540
540
|
*/
|
|
541
541
|
activateAgent(chainId: number, agentId?: AgentId[]): Promise<void>;
|
|
542
|
+
/**
|
|
543
|
+
* Activate agents ONE AT A TIME, each followed by its org policy.
|
|
544
|
+
*
|
|
545
|
+
* Every agent opens its activation with its own wallet signature — Zyfai's
|
|
546
|
+
* SIWX (exchanged for a JWT) and SurfLiquid's SIWE (exchanged for an httpOnly
|
|
547
|
+
* cookie). Run in parallel, that puts two `personal_sign` requests on one
|
|
548
|
+
* wallet connection in the same instant. Over WalletConnect both are
|
|
549
|
+
* delivered to the wallet, which renders one signing request at a time and
|
|
550
|
+
* queues or silently drops the other: neither promise settles, so activation
|
|
551
|
+
* hangs until the caller's timeout with no prompt the user can act on. The
|
|
552
|
+
* single-agent era never hit this — there was no second prompt to collide
|
|
553
|
+
* with — so it appeared the moment a second agent became eligible.
|
|
554
|
+
*
|
|
555
|
+
* Serializing costs no real wall-clock: the user can only approve one prompt
|
|
556
|
+
* at a time anyway.
|
|
557
|
+
*
|
|
558
|
+
* Every agent is attempted even if an earlier one fails, so one declined
|
|
559
|
+
* signature can't deny the remaining agents their turn. The first failure is
|
|
560
|
+
* rethrown (matching the previous `Promise.all` rejection) once all agents
|
|
561
|
+
* have had a chance to activate.
|
|
562
|
+
*/
|
|
563
|
+
private activateAgentsInTurn;
|
|
542
564
|
/**
|
|
543
565
|
* Deposit funds into a specific agent, or split equally across all agents if agentId is omitted.
|
|
544
566
|
* Validates that the asset is supported and amount meets minimums for the target agent(s).
|
package/dist/index.js
CHANGED
|
@@ -2923,12 +2923,7 @@ var OwneySDK = class {
|
|
|
2923
2923
|
this.activeAgents.add(id);
|
|
2924
2924
|
}
|
|
2925
2925
|
state.chainId = chainId;
|
|
2926
|
-
|
|
2927
|
-
agents.map(async (agent) => {
|
|
2928
|
-
await agent.activateAgent(state, chainId);
|
|
2929
|
-
await this.applyOrgPolicyTo(agent, state, chainId);
|
|
2930
|
-
})
|
|
2931
|
-
).catch((error) => {
|
|
2926
|
+
this.activateAgentsInTurn(agents, state, chainId).catch((error) => {
|
|
2932
2927
|
console.error("activateAgent background init failed:", error);
|
|
2933
2928
|
});
|
|
2934
2929
|
return;
|
|
@@ -2951,14 +2946,48 @@ var OwneySDK = class {
|
|
|
2951
2946
|
const enabledCompatible = compatible.filter(
|
|
2952
2947
|
(agent) => !this.isAgentDisabled(agent.id)
|
|
2953
2948
|
);
|
|
2954
|
-
|
|
2955
|
-
|
|
2949
|
+
this.activateAgentsInTurn(enabledCompatible, state, chainId).catch(
|
|
2950
|
+
(error) => {
|
|
2951
|
+
console.error("activateAgent background init failed:", error);
|
|
2952
|
+
}
|
|
2953
|
+
);
|
|
2954
|
+
}
|
|
2955
|
+
/**
|
|
2956
|
+
* Activate agents ONE AT A TIME, each followed by its org policy.
|
|
2957
|
+
*
|
|
2958
|
+
* Every agent opens its activation with its own wallet signature — Zyfai's
|
|
2959
|
+
* SIWX (exchanged for a JWT) and SurfLiquid's SIWE (exchanged for an httpOnly
|
|
2960
|
+
* cookie). Run in parallel, that puts two `personal_sign` requests on one
|
|
2961
|
+
* wallet connection in the same instant. Over WalletConnect both are
|
|
2962
|
+
* delivered to the wallet, which renders one signing request at a time and
|
|
2963
|
+
* queues or silently drops the other: neither promise settles, so activation
|
|
2964
|
+
* hangs until the caller's timeout with no prompt the user can act on. The
|
|
2965
|
+
* single-agent era never hit this — there was no second prompt to collide
|
|
2966
|
+
* with — so it appeared the moment a second agent became eligible.
|
|
2967
|
+
*
|
|
2968
|
+
* Serializing costs no real wall-clock: the user can only approve one prompt
|
|
2969
|
+
* at a time anyway.
|
|
2970
|
+
*
|
|
2971
|
+
* Every agent is attempted even if an earlier one fails, so one declined
|
|
2972
|
+
* signature can't deny the remaining agents their turn. The first failure is
|
|
2973
|
+
* rethrown (matching the previous `Promise.all` rejection) once all agents
|
|
2974
|
+
* have had a chance to activate.
|
|
2975
|
+
*/
|
|
2976
|
+
async activateAgentsInTurn(agents, state, chainId) {
|
|
2977
|
+
let firstError = null;
|
|
2978
|
+
for (const agent of agents) {
|
|
2979
|
+
try {
|
|
2956
2980
|
await agent.activateAgent(state, chainId);
|
|
2957
2981
|
await this.applyOrgPolicyTo(agent, state, chainId);
|
|
2958
|
-
})
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2982
|
+
} catch (error) {
|
|
2983
|
+
if (firstError === null) {
|
|
2984
|
+
firstError = error;
|
|
2985
|
+
} else {
|
|
2986
|
+
console.error(`activateAgent(${agent.id}) failed:`, error);
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
if (firstError !== null) throw firstError;
|
|
2962
2991
|
}
|
|
2963
2992
|
/**
|
|
2964
2993
|
* Deposit funds into a specific agent, or split equally across all agents if agentId is omitted.
|